refspec: store raw refspecs inside refspec_item
[git/gitster.git] / trace2 / tr2_cmd_name.c
blobb7b5a869b74bcd02c4157d87212359c7dc47e668
1 #include "git-compat-util.h"
2 #include "strbuf.h"
3 #include "trace2/tr2_cmd_name.h"
5 #define TR2_ENVVAR_PARENT_NAME "GIT_TRACE2_PARENT_NAME"
7 static struct strbuf tr2cmdname_hierarchy = STRBUF_INIT;
9 void tr2_cmd_name_append_hierarchy(const char *name)
11 const char *parent_name = getenv(TR2_ENVVAR_PARENT_NAME);
13 strbuf_reset(&tr2cmdname_hierarchy);
14 if (parent_name && *parent_name) {
15 strbuf_addstr(&tr2cmdname_hierarchy, parent_name);
16 strbuf_addch(&tr2cmdname_hierarchy, '/');
18 strbuf_addstr(&tr2cmdname_hierarchy, name);
20 setenv(TR2_ENVVAR_PARENT_NAME, tr2cmdname_hierarchy.buf, 1);
23 const char *tr2_cmd_name_get_hierarchy(void)
25 return tr2cmdname_hierarchy.buf;
28 void tr2_cmd_name_release(void)
30 strbuf_release(&tr2cmdname_hierarchy);