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

Re: [PATCH] remote: resolve "simple" @{push} when pushing to another remote

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 29, 2026, 17:48 UTC
Message-ID
<xmqq8q3g4cv1.fsf@gitster.g>
In-Reply-To
<CALnO6CBxMrv01NMqEPCLbGbCPXX9T2Jgjax-L5s2z9s-eUpNDQ@mail.gmail.com>
"D. Ben Knoble" <ben.knoble@gmail.com> writes:
Show 19 quoted lines
>> diff --git a/remote.c b/remote.c
>> index 49ee2ea318..fd434a3a10 100644
>> --- a/remote.c
>> +++ b/remote.c
>> @@ -2016,6 +2016,10 @@ static char *branch_get_push_1(struct repository *repo,
>>                         const char *up;
>>                         char *cur;
>>
>> +                       if (strcmp(remote->name,
>> +                                  remotes_remote_for_branch(remote_state, branch, NULL)))
>> +                               return tracking_for_push_dest(repo, remote, branch->refname, err);
>
> This certainly matches the logic described in the log message, and I
> think it's probably right based on that description. One thing I can't
> decide is whether it should come before or after the current set of
> cases, and I'm undecided. On one hand, it's a new case, so I would
> think it should come after. OTOH, it's a fairly straightforward case,
> and I usually like discharging those early so I can focus on the
> complex stuff.

I actually wondered if the existing case for "simple" becomes a subset of this new code? After all, tracking_for_push_dest() asks where the thing gets pushed to, no?

In any case, all the case arms in this function is getting a bit unmanageably long and this block is, with an extra artificial block, unnecessarily deeply nested by one extra level. I wonder if we can move the code for "case PUSH_DEFAULT_SIMPLE" case to a separate function and make it a bit more readable?

I agree that the end result the commit wants to see is sensible and consistent with the earlier "what should happen with 'simple' when triangular?" topic.

Thanks.
Previous: Harald NordgrenNext: Harald Nordgren
Message 4 of 5 in “remote: resolve "simple" @{push} when pushing to another remote”
  1. remote: resolve "simple" @{push} when pushing to another remoteHarald Nordgren via GitGitGadget, Oct 27, 2026
  2. D. Ben KnobleOct 28, 2026
  3. Harald NordgrenOct 29, 2026
  4. Junio C HamanoOct 29, 2026
  5. Harald NordgrenOct 29, 2026

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.