git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Ben Boeckel <mathstuf@gmail.com>
Cc: git@vger.kernel.org, "Martin Ågren" <martin.agren@gmail.com>,
	"Junio C Hamano" <gitster@pobox.com>, "Jeff King" <peff@peff.net>,
	"Jeff Hostetler" <jeffhost@microsoft.com>,
	"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>,
	"Taylor Blau" <me@ttaylorr.com>
Subject: Re: [PATCH 1/1] config: support a default remote tracking setup upon branch creation
Date: Mon, 02 Aug 2021 17:20:01 +0200	[thread overview]
Message-ID: <87k0l3oo38.fsf@evledraar.gmail.com> (raw)
In-Reply-To: <YQfwJOxlBOUWiH1V@erythro.dev.benboeckel.internal>


On Mon, Aug 02 2021, Ben Boeckel wrote:

> On Mon, Aug 02, 2021 at 15:02:41 +0200, Ævar Arnfjörð Bjarmason wrote:
>> On Wed, Jul 28 2021, Ben Boeckel wrote:
>> > The `branch.autoSetupMerge` works well today for setting up tracking a
>> > local branch, but there is no easy mechanism to automatically set up a
>> > remote tracking situation for workflows which use a single set of
>> > branches for integration without specifying `--track` to every branch
>> > creation command or branching directly from the remote ref. This patch
>> > adds the following configuration values:
>> >
>> >   - `branch.defaultRemote`: initializes `branch.<name>.remote` if not
>> >     otherwise given;
>> >   - `branch.defaultMerge`: initializes `branch.<name>.merge` if not
>> >     otherwise given.
>> 
>> Not a new issue per-se, but what if you've got a branch called
>> defaultRemote? It seems to me that any new branch.<name>.* config closes
>> the door for a <name> we squat on.
>
> It doesn't seem that shadowing is actually a thing:
>
>     % git init
>     Initialized empty Git repository in …/git-shadow/.git/
>     % git config foo.bar true
>     % git config foo.bar.baz true
>     % git config --get foo.bar
>     true
>     % git config --get foo.bar.baz
>     true

You're right, I was misrecalling (or mis-imagining) some edge case there
that doesn't exist. I also tested setting branch.defaultRemote=true and
moving a branch.defaultRemote.* branch with "git branch -m", but it also
does the right thing. Nevermind.

>> Given that we have checkout.defaultRemote and this also affects
>> switch/checkout it seems better to continue in the checkout.* namespace
>> even if it wasn't for that, but given the config squatting issue
>> especially so....
>> 
>> For what it's worth I usually use the checkout.defaultRemote option
>> (which I added) and:
>> 
>>     git checkout master &&
>>     git branch -m master <topic-name>
>> 
>> See 8d7b558baeb (checkout & worktree: introduce checkout.defaultRemote,
>> 2018-06-05). It seems to me from that patch diff that you could modify
>> some docs / tests for this, no? E.g. how it interacts with git-worktree.
>
> I think it would be weird for `checkout.*` to affect `git branch` which
> does no checkout at all. I want it to set up for simple branch creation
> as well, so this would be a hole in my use case.

*nod*, although your approach has the opposite problem of making branch
creation with "checkout" and "switch" (and presumably "worktree")
impacted by "branch.*' config.

In a way that's more sensible, in that we can imagine those commands
calling "git branch" under the hood (which msotly doesn't actually
happen, except I think in the worktree case, but it's the same
underlying APIs).

..

>> I like this direction, but just have a concern that this is a place
>> where we need to consider all the UX in the area overall, and that any
>> options/config don't overtly interact in a bad way.
>
> I'll have to look at adding test cases as to how it interacts with
> `checkout.defaultRemote`.
>
> Thanks,

....right, none of that mess is a showstopper, I'm just prodding you to
look at if any of those edge cases are made better/worse by these
additions. Thanks!

  reply	other threads:[~2021-08-02 15:36 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-28 13:50 [PATCH 0/1] Improve automatic setup of tracking for new branches Ben Boeckel
2021-07-28 13:50 ` [PATCH 1/1] config: support setting up a remote tracking branch upon creation Ben Boeckel
2021-07-28 17:48   ` Junio C Hamano
2021-07-28 18:26     ` Ben Boeckel
2021-07-28 18:39       ` Junio C Hamano
2021-07-29  2:01 ` [PATCH 0/1] Improve automatic setup of tracking for new branches Ben Boeckel
2021-07-29  2:01   ` [PATCH 1/1] config: support a default remote tracking setup upon branch creation Ben Boeckel
2021-07-30 13:35     ` Philippe Blain
2021-07-30 14:07       ` Ben Boeckel
2021-07-30 17:32       ` Junio C Hamano
2021-08-02 13:02     ` Ævar Arnfjörð Bjarmason
2021-08-02 13:16       ` Ben Boeckel
2021-08-02 15:20         ` Ævar Arnfjörð Bjarmason [this message]
2021-07-30  1:04   ` [PATCH 0/1] Improve automatic setup of tracking for new branches Junio C Hamano
2021-07-30  1:33     ` Ben Boeckel
2021-07-30 13:35   ` Philippe Blain
2021-07-30 13:57     ` Ben Boeckel
2021-07-30 16:01       ` Philippe Blain
2021-07-30 17:45         ` Ben Boeckel
2021-08-02 21:17         ` Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k0l3oo38.fsf@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jeffhost@microsoft.com \
    --cc=martin.agren@gmail.com \
    --cc=mathstuf@gmail.com \
    --cc=me@ttaylorr.com \
    --cc=pclouds@gmail.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).