Re: [PATCH 0/9] Allow overriding the default name of the default branch
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Jun 23, 2020, 20:28 UTC
- Message-ID
- <nycvar.QRO.7.76.6.2006232214030.54@tvgsbejvaqbjf.bet>
- In-Reply-To
- <20200616142423.GA667151@coredump.intra.peff.net>
Hi Peff & Ævar,
On Tue, 16 Jun 2020, Jeff King wrote:
Show 15 quoted lines
> On Tue, Jun 16, 2020 at 10:09:32AM -0400, Jeff King wrote: > > > I think with that, we could ditch core.mainBranch entirely, with no > > notion at all of "this branch is special in this repo". We use HEAD > > where appropriate, and otherwise avoid any specialness. > > One obvious exception is that third-party tools may want to know the > "special" branch for some reason. But I'm inclined to say that they > should (in this order): > > - consider whether they really need a special branch at all, or if the > mechanism can be made more generic > > - consider whether HEAD is the best value for a special branch (e.g., > GitHub pull requests default to targeting HEAD)
Indeed, this is applicable in many circumstances. For example, instead of https://github.com/git/git/blob/master/README.md it is just as easy (and more robust) to write https://github.com/git/git/blob/HEAD/README.md.
The same goes for `git ls-remote origin HEAD` and as a consequence, `git fetch origin HEAD`: it fetches the default branch of the remote repository.
And with that, I could imagine that this is not actually necessary:
Show 5 quoted lines
> - rely on per-tool config for what's special (because it really may > vary between tools, and that's more flexible anyway) > > But I'm open to hearing about cases where some tool really wants to know > "what did the user consider the special branch at the time of creation".
I cannot think of any use cases, apart from essentially creating a new repository, where a tool or a user would want to know of such a preference.
Ciao, Dscho