mirror of
https://github.com/git/git
synced 2024-10-30 14:03:28 +00:00
a64acf7298
The last several commits were geared at replacing the include of cache.h in strbuf.c with an include of git-compat-util.h. Unfortunately, I had to drop a patch moving some functions from cache.h to object-name.h, due to excessive conflicts with other in-flight topics. However, even without that patch, the series of patches so far allows us to modify a number of C files to replace an include of cache.h with git-compat-util.h. Do that to reduce our dependencies. (If we could have kept our object-name.h patch in this series, it would have also let us reduce the includes in checkout.c and fmt-merge-msg.c in addition to strbuf.c). Just to ensure that nothing else was bringing in cache.h, all of the affected files have been checked to ensure that gcc -E -I. $SOURCE_FILE | grep '"cache.h"' found no hits and that make DEVELOPER=1 ${OBJECT_FILE_FOR_SOURCE_FILE} successfully compiles without warnings. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
31 lines
758 B
C
31 lines
758 B
C
#include "git-compat-util.h"
|
|
#include "strbuf.h"
|
|
#include "trace2/tr2_cmd_name.h"
|
|
|
|
#define TR2_ENVVAR_PARENT_NAME "GIT_TRACE2_PARENT_NAME"
|
|
|
|
static struct strbuf tr2cmdname_hierarchy = STRBUF_INIT;
|
|
|
|
void tr2_cmd_name_append_hierarchy(const char *name)
|
|
{
|
|
const char *parent_name = getenv(TR2_ENVVAR_PARENT_NAME);
|
|
|
|
strbuf_reset(&tr2cmdname_hierarchy);
|
|
if (parent_name && *parent_name) {
|
|
strbuf_addstr(&tr2cmdname_hierarchy, parent_name);
|
|
strbuf_addch(&tr2cmdname_hierarchy, '/');
|
|
}
|
|
strbuf_addstr(&tr2cmdname_hierarchy, name);
|
|
|
|
setenv(TR2_ENVVAR_PARENT_NAME, tr2cmdname_hierarchy.buf, 1);
|
|
}
|
|
|
|
const char *tr2_cmd_name_get_hierarchy(void)
|
|
{
|
|
return tr2cmdname_hierarchy.buf;
|
|
}
|
|
|
|
void tr2_cmd_name_release(void)
|
|
{
|
|
strbuf_release(&tr2cmdname_hierarchy);
|
|
}
|