From: Johannes Schindelin <johannes.schindelin@xxxxxx> When anonymizing commit history, we are careful to leave the branch name of the default branch alone. When the default branch name is overridden via the config or via the environment variable, we will want `git fast-export` to use that overridden name instead. Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx> --- builtin/fast-export.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/builtin/fast-export.c b/builtin/fast-export.c index 85868162eec..028dd9969a2 100644 --- a/builtin/fast-export.c +++ b/builtin/fast-export.c @@ -515,13 +515,17 @@ static const char *anonymize_refname(const char *refname) }; static struct hashmap refs; static struct strbuf anon = STRBUF_INIT; + static char *default_branch_name; int i; /* - * We also leave "master" as a special case, since it does not reveal - * anything interesting. + * We also leave the default branch name as a special case, since it + * does not reveal anything interesting. */ - if (!strcmp(refname, "refs/heads/master")) + if (!default_branch_name) + default_branch_name = git_default_branch_name(0); + + if (!strcmp(refname, default_branch_name)) return refname; strbuf_reset(&anon); -- gitgitgadget