Hi Junio & Hannes, On Sat, 13 Jun 2020, Junio C Hamano wrote: > Johannes Sixt <j6t@xxxxxxxx> writes: > > > Am 12.06.20 um 17:14 schrieb Junio C Hamano: > >> /* > >> * Anonymize the name used for the primary branch in this > >> * repository, but reserve `ref0` for it, so that it can > >> * be identified among other refs in the output. > >> */ > >> > >> is the minimum I would expect before calling it an improvement. We > >> could add > >> > >> It is often `main` for new repositories (and `master` for > >> aged ones) and such well-known names may not need > >> anonymizing, but it could be configured to use a secret word > >> that the user may not want to reveal. > >> > >> at the end to explain the motivation behind anonymizing even more, > >> if we wanted to. > > > > IMO, making the primary branch identifiable is a reasonable > > justification to treat it specially. But then, why does it have to be > > renamed to 'ref0'? Couldn't it just be renamed to Git's default primary > > branch name, be it 'master' today or 'main' or whatever in the future? > > That comes from https://lore.kernel.org/git/xmqqtuzha6xn.fsf@xxxxxxxxxxxxxxxxxxxxxx/ > > But I agree with you 100% if you literally mean 'master' (or 'main') > hardcoded without any end-user customization. What I rejected and > replaced with the vanilla "ref0" was to return the configured name > that will be used for the primary branch in new repositories. The > above proposal suggested a faulty: > > - if (!strcmp(refname, "refs/heads/master")) > - return refname; > + if (!strcmp(refname, get_primary_branch_name(DO_NOT_ABBREV))) > + return get_default_branch_name(DO_NOT_ABBREV); > > A corrected code should return a hardwired constant 'main' (it > probably gets behind a C preprocessor macro, but the point is that > we do not want end-user customization) for the reason stated in that > message. I like `ref0` better, for two reasons: - it is more consistent to just have all anonymized branches be named `ref<N>`, and - using `main` both for an original `main` and an original `master` can be a bit confusing, as the reader might assume that this branch name (as it does not follow the `ref<N>` convention) was _not_ anonymized, when it very well might have been. Ciao, Dscho