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

Another look?

From: Harald Nordgren <hidden>
Date: 2026-01-03 13:00:09

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! I have updated the code and added a test for remapped refspec.

With that said, I don't 100% understand what I'm doing with the refspecs, so
maybe you can give it another review?


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