Re: [PATCH] remote: resolve "simple" @{push} when pushing to another remote
- From
Harald Nordgren <haraldnordgren@gmail.com>
- Date
- Oct 29, 2026, 22:15 UTC
- Message-ID
- <CAHwyqnWSAu6ZqC2HcL8a0HSMKRHZGwvfqx0bi_vRMWc=t_-b+Q@mail.gmail.com>
- In-Reply-To
- <xmqq8q3g4cv1.fsf@gitster.g>
Show 15 quoted lines
> >> + 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?
Yes, both resolve to the same branch. The same remote case only adds a check that the upstream has the same name, because "git push" refuses otherwise.
Show 5 quoted lines
> 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?
Good point.
Harald