Subject: Another look?

From: Harald Nordgren <[email-masked]>
Date: Sat, 3 Jan 2026 14:00:05 +0100

> 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