THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Git Source Code Mirror - This is a publish-only repository and all pull requests are ignored. Please follow Documentation/SubmittingPatches procedure for any of your improvements.
git
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
728B

  1. #include "cache.h"
  2. #include "trace2/tr2_cmd_name.h"
  3. #define TR2_ENVVAR_PARENT_NAME "GIT_TRACE2_PARENT_NAME"
  4. static struct strbuf tr2cmdname_hierarchy = STRBUF_INIT;
  5. void tr2_cmd_name_append_hierarchy(const char *name)
  6. {
  7. const char *parent_name = getenv(TR2_ENVVAR_PARENT_NAME);
  8. strbuf_reset(&tr2cmdname_hierarchy);
  9. if (parent_name && *parent_name) {
  10. strbuf_addstr(&tr2cmdname_hierarchy, parent_name);
  11. strbuf_addch(&tr2cmdname_hierarchy, '/');
  12. }
  13. strbuf_addstr(&tr2cmdname_hierarchy, name);
  14. setenv(TR2_ENVVAR_PARENT_NAME, tr2cmdname_hierarchy.buf, 1);
  15. }
  16. const char *tr2_cmd_name_get_hierarchy(void)
  17. {
  18. return tr2cmdname_hierarchy.buf;
  19. }
  20. void tr2_cmd_name_release(void)
  21. {
  22. strbuf_release(&tr2cmdname_hierarchy);
  23. }