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

Re: [PATCH] branch: optionally setup branch.*.merge from upstream local branches

From
Jay Soffian <jaysoffian@gmail.com>
Date
Feb 18, 2008, 12:40 UTC
Message-ID
<76718490802180440o3041b1ffh4764199e2aeaa52b@mail.gmail.com>
In-Reply-To
<alpine.LSU.1.00.0802181209210.30505@racer.site>
On Feb 18, 2008 7:14 AM, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
Show 8 quoted lines
> On Mon, 18 Feb 2008, Jay Soffian wrote:
>
> > +enum branch_track {
> > +     BRANCH_TRACK_FALSE = 0,
> > +     BRANCH_TRACK_TRUE = 1,
>
> BRANCH_TRACK_REMOTES would be a better name here.  And you do not need the
> "= 1" and "= 2".

I was just following along. Plenty of enum examples in the current code do this. Am I missing something subtle about when assigning explicit values should be done?

Show 5 quoted lines
> >
> > -static int branch_track = 1;
> > +static enum branch_track branch_track = BRANCH_TRACK_FALSE;
>
> That is a clear regression.

Perhaps. It's consistent with builtin-checkout.c though (which was initializing it to 0). Who to believe?

Show 16 quoted lines
> > @@ -77,6 +77,10 @@ static int git_branch_config(const char *var, const char *value)
> >               return 0;
> >       }
> >       if (!strcmp(var, "branch.autosetupmerge")) {
> > +             if (value && !strcasecmp(value, "always")) {
> > +                     branch_track = BRANCH_TRACK_ALWAYS;
> > +                     return 0;
> > +             }
> >               branch_track = git_config_bool(var, value);
> >               return 0;
> >       }
>
> You have this in builtin-branch.c and builtin-checkout.c.  Duplicated
> code.  IMHO it is time to move this into the git_default_config() function
> (with "branch_track" being renamed to "git_branch_track", and moved to
> environment.c).
Mkay, builtin-checkout.c author didn't do it, so...
> Personally, I have no problem with typing "git merge <branch>" in your
> workflow.  I would even avoid saying "git pull" for obviously-local
> branches, because I would have forgotten which branch it tracked
> originally.

Um, well, apply this patch, set branch.autosetupmerge=always and then branch.*.merge will tell you which branch it tracked originally. :-)

Aside, then how do you figure out the upstream branch is if you've forgotten?

j.
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 3 of 4 in “branch: optionally setup branch.*.merge from upstream local branches”
  1. branch: optionally setup branch.*.merge from upstream local branchesJay Soffian, Feb 18, 2008
  2. Johannes SchindelinFeb 18, 2008
  3. Jay SoffianFeb 18, 2008
  4. Johannes SchindelinFeb 18, 2008

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.