git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Avoiding 'master' nomenclature

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Jul 29, 2020, 21:20 UTC
Message-ID
<CAHk-=wg7r=y_tYpWuRwNFP0JU5D4g=UN1puCzkvQP4bey0-Hmw@mail.gmail.com>
In-Reply-To
<20200729205846.GA2992025@coredump.intra.peff.net>
On Wed, Jul 29, 2020 at 1:58 PM Jeff King <peff@peff.net> wrote:
Show 6 quoted lines
>
> Users can set init.defaultBranch in individual repository config files
> to get the right behavior, though probably it should be a separate
> config variable (the reason it is init.defaultBranch and not
> core.defaultBranch is that you may want different defaults for different
> operations).
That would probably be even better, yes.
It's hard to tell what the default branch of any _particular_ repo is, though.

One option that I considered was to just suppress both "master" (because that's clearly an old default value) _and_ the new git_default_branch_name() (as the new default value).

But you're right that you can then interact with systems that have used yet other defaults.

That said, I still claim that my one-liner is better than what actually got merged.

Show 6 quoted lines
> So I think a path forward is more like:
>
>   1. Add a new config option to shorten fmt-merge-msg's output when the
>      destination branch matches it (and this should perhaps not even be
>      a single name, but a set of globs, which supports more workflows).
>      Call it merge.suppressDest or something.
On that note, I have a special
   .git/hooks/prepare-commit-msg
in my tree, because I want to regularly replace the URL I pull from.

In particular, for kernel.org, I actually pull through the non-public-facing master machine (because that way I don't encounter mirroring delays etc, and since I don't _require_ that people sign their kernel.org trees, I want to make sure nobody does any spoofing).

So I use the "url.X.insteadOf" git config functionality to do the replacement of the URL on the incoming side.

But for the merge messages, I want to do the reverse, and don't want to expose those not-usable-to-others addresses, so I replace that ssh access with the public-facing "git://git.kernel.org/" instead.

I use that prepare-commit-msg hook to do that.

I *could* have done that for branch names too, but that is something that git has done right for the last 15+ years, so I never had to worry or think about it.

But a generic replacement (or generation) machinery for the whole line would be lovely. And then perhaps just _default_ that regex to be the equivalent of

   sed 's/ into master$//'

would work really well not just for the branch name prettification, but also for things like that "internal vs external hostnames".

Show 5 quoted lines
>   2. Optionally a repository created with "git init" could copy its
>      init.defaultBranch into merge.suppressDest. And likewise a clone
>      might copy the remote HEAD into that variable. I'm not sure if that
>      is worth doing or not, but it would restore the original behavior
>      for the most part.

Well, the real objection I have to that commit 489947cee5 is that it breaks existing users workflow.

So some way of suppressing "into master" by default should be part of the solution regardless.

Making it optional, so that people who *want* to show the default branch name can do so, and specify what it is, that sounds like a good idea.

But breaking existing users - that I find to be very objectionable.
                  Linus
Previous: Jeff KingNext: Jeff King
Message 12 of 42 in “Avoiding 'master' nomenclature”
  1. Linus TorvaldsJul 29, 2020
  2. Junio C HamanoJul 29, 2020
  3. Linus TorvaldsJul 29, 2020
  4. Jonathan NiederJul 29, 2020
  5. Linus TorvaldsJul 29, 2020
  6. Linus TorvaldsJul 29, 2020
  7. lego_12239@rambler.ruJul 30, 2020
  8. Jeff KingJul 31, 2020
  9. OlegJul 31, 2020
  10. Linus TorvaldsJul 29, 2020
  11. Jeff KingJul 29, 2020
  12. Linus TorvaldsJul 29, 2020
  13. Jeff KingJul 30, 2020
  14. Linus TorvaldsJul 30, 2020
  15. Jeff KingJul 30, 2020
  16. Linus TorvaldsJul 30, 2020
  17. Jeff KingJul 31, 2020
  18. Junio C HamanoJul 29, 2020
  19. Junio C HamanoJul 29, 2020
  20. Jeff KingJul 30, 2020
  21. Linus TorvaldsJul 30, 2020
  22. Michal SuchánekJul 30, 2020
  23. Jeff KingJul 30, 2020
  24. Junio C HamanoJul 30, 2020
  25. 0/2 fmt-merge-msg: selectively suppress "into <branch>"Junio C Hamano, Jul 30, 2020
  26. 2/2 fmt-merge-msg: allow merge destination to be omitted againJunio C Hamano, Jul 30, 2020
  27. 1/2 Revert "fmt-merge-msg: stop treating `master` specially"Junio C Hamano, Jul 30, 2020
  28. Eric SunshineJul 30, 2020
  29. Junio C HamanoJul 30, 2020
  30. Jeff KingJul 31, 2020
  31. Junio C HamanoJul 31, 2020
  32. Jeff KingJul 31, 2020
  33. Taylor BlauJul 31, 2020
  34. Junio C HamanoJul 31, 2020
  35. Taylor BlauJul 31, 2020
  36. Michal SuchánekAug 1, 2020
  37. Johannes SchindelinAug 10, 2020
  38. Junio C HamanoAug 10, 2020
  39. Johannes SchindelinAug 11, 2020
  40. Junio C HamanoAug 12, 2020
  41. Junio C HamanoJul 29, 2020
  42. Linus TorvaldsJul 29, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.