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

Re: [PATCH 1/1] config: support a default remote tracking setup upon branch creation

From
Ben Boeckel <mathstuf@gmail.com>
Date
Aug 2, 2021, 13:16 UTC
Message-ID
<YQfwJOxlBOUWiH1V@erythro.dev.benboeckel.internal>
In-Reply-To
<87sfzsngad.fsf@evledraar.gmail.com>
On Mon, Aug 02, 2021 at 15:02:41 +0200, Ævar Arnfjörð Bjarmason wrote:
Show 16 quoted lines
> 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
Show 14 quoted lines
> 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.

> 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,
--Ben
Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 12 of 20 in “Improve automatic setup of tracking for new branches”
  1. 0/1 Improve automatic setup of tracking for new branchesBen Boeckel, Jul 28, 2021
  2. 1/1 config: support setting up a remote tracking branch upon creationBen Boeckel, Jul 28, 2021
  3. Junio C HamanoJul 28, 2021
  4. Ben BoeckelJul 28, 2021
  5. Junio C HamanoJul 28, 2021
  6. 0/1 Improve automatic setup of tracking for new branchesBen Boeckel, Jul 29, 2021
  7. 1/1 config: support a default remote tracking setup upon branch creationBen Boeckel, Jul 29, 2021
  8. Philippe BlainJul 30, 2021
  9. Ben BoeckelJul 30, 2021
  10. Junio C HamanoJul 30, 2021
  11. Ævar Arnfjörð BjarmasonAug 2, 2021
  12. Ben BoeckelAug 2, 2021
  13. Ævar Arnfjörð BjarmasonAug 2, 2021
  14. Junio C HamanoJul 30, 2021
  15. Ben BoeckelJul 30, 2021
  16. Philippe BlainJul 30, 2021
  17. Ben BoeckelJul 30, 2021
  18. Philippe BlainJul 30, 2021
  19. Ben BoeckelJul 30, 2021
  20. Johannes SchindelinAug 2, 2021

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.