Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/trace2/tr2_cmd_name.c # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / trace2 / tr2_cmd_name.c` 31 lines ยท 758 bytes Raw Blame History 1 #include "git-compat-util.h" 2 #include "strbuf.h" 3 #include "trace2/tr2_cmd_name.h" 4 5 #define TR2_ENVVAR_PARENT_NAME "GIT_TRACE2_PARENT_NAME" 6 7 static struct strbuf tr2cmdname_hierarchy = STRBUF_INIT; 8 9 void tr2_cmd_name_append_hierarchy(const char *name) 10 { 11 const char *parent_name = getenv(TR2_ENVVAR_PARENT_NAME); 12 13 strbuf_reset(&tr2cmdname_hierarchy); 14 if (parent_name && *parent_name) { 15 strbuf_addstr(&tr2cmdname_hierarchy, parent_name); 16 strbuf_addch(&tr2cmdname_hierarchy, '/'); 17 } 18 strbuf_addstr(&tr2cmdname_hierarchy, name); 19 20 setenv(TR2_ENVVAR_PARENT_NAME, tr2cmdname_hierarchy.buf, 1); 21 } 22 23 const char *tr2_cmd_name_get_hierarchy(void) 24 { 25 return tr2cmdname_hierarchy.buf; 26 } 27 28 void tr2_cmd_name_release(void) 29 { 30 strbuf_release(&tr2cmdname_hierarchy); 31 }