Thread (141 messages) 141 messages, 8 authors, 2026-03-04

Re: Another look?

From: Phillip Wood <hidden>
Date: 2026-01-03 10:04:04

On 02/01/2026 20:27, Harald Nordgren wrote:
quoted
Shouldn't we be taking account of the push and fetch refspecs here? There
is no guarantee that $branch maps to refs/remotes/$remote/$branch. To take
a silly example, if we have

      remote.$remote.fetch =
refs/heads/$branch:refs/remotes/$remote/abc-$branch remote.$remote.pull =
refs/heads/$branch:refs/heads/xyz-$branch

Then we should be using "refs/remotes/$remote/abc-xyz-$branch" in the
message above as "$branch" will be pushed to "xyz-$branch" on the remote
which is fetched to "$remote/abc-xyz-$branch"
I don't understand this one, can you maybe explain how to code will need to
change?
You want to display the remote tracking ref that tracks ref on the 
remote that we push to. When git pushes $branch to $remote it checks if 
any of the push refspecs remote.$remote.push match $branch. If there is 
a match then the branch name is mapped according to the refspec and that 
it the ref that is updated in the remote repository. It then takes that 
ref and checks the fetch refspecs remote.$remote.fetch and if it finds a 
match it maps the ref we've pushed to a remote tracking ref in the local 
repository.

It looks like you can find where we would push a branch to with 
remote_ref_for_branch() and you can map that to a remote tracking ref 
with tracking_for_push_dest(). We could use branch_get_push() but does 
more than just map the refs as it checks push.default to see whether 
"git push" would actually push the branch.

Thanks

Phillip
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help