Hi Junio, On Thu, 11 Jun 2020, Junio C Hamano wrote: > Junio C Hamano <gitster@xxxxxxxxx> writes: > > >> diff --git a/builtin/fast-export.c b/builtin/fast-export.c > >> index 85868162ee..a306a60d25 100644 > >> --- a/builtin/fast-export.c > >> +++ b/builtin/fast-export.c > >> @@ -497,7 +497,7 @@ static void *anonymize_ref_component(const void *old, size_t *len) > >> { > >> static int counter; > >> struct strbuf out = STRBUF_INIT; > >> - strbuf_addf(&out, "ref%d", counter++); > >> + strbuf_addf(&out, "ref%d", ++counter); > >> return strbuf_detach(&out, len); > >> } > >> > >> @@ -522,7 +522,7 @@ static const char *anonymize_refname(const char *refname) > >> * anything interesting. > >> */ > >> if (!strcmp(refname, "refs/heads/master")) > >> - return refname; > >> + return "ref0"; > > > > This is obviously wrong. It should return "refs/heads/ref0". > > ... > > So, I guess we should just fix the patch I am responding to to > > return "refs/heads/ref0" instead of "ref0", and queue it as one of > > the preparatory steps. > > ... and the follow-up step to become part of the series you are > working on to allow customing what the primary branch is called > would turn the second hunk to > > - if (!strcmp(refname, "refs/heads/master")) > + if (!strcmp(refname, get_primary_branch_name(0))) > return "refs/heads/ref0"; Right. > By the way, with your "two variables" approach to make both the > "default" (for 'init' and 'clone') and the "primary" (for > 'fmt-merge-msg' and 'fast-export') configurable, we'd need accessor > function(s) for the primary branch name for the given repository. > The get_primary_branch_name() helper function might want to take a > "struct repository *" argument in addition to "please give me an > abbreviated refname" boolean, given the recent push to pass the > struct to everybody. My current state defines a `repo_main_branch_name(flags)` function where the flags can be `MAIN_BRANCH_SHORT_NAME` and `MAIN_BRANCH_FOR_INIT`. So I think we're on the same page. BTW I heard from a couple sides that "primary" would imply that there is also a "secondary" branch, and potentially an ordering of all branches, which is why I did not really consider "primary" as candidate. Besides, it is so much more awkward to type than "main" (especially when you're as tired as I am right now...). That's why I try to stay with "main" for the moment. Ciao, Dscho