Re: Avoiding 'master' nomenclature

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 29, 2020 at 1:58 PM Jeff King <peff@xxxxxxxx> wrote:
>
> 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.

> 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".

>   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



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux