Re: [PATCH v17 1/2] refactor format_branch_comparison in preparation
From: Phillip Wood <hidden>
Date: 2026-01-13 10:41:55
On 12/01/2026 19:47, Harald Nordgren wrote:
quoted
It is hard to discuss this without knowing what actually breaks. Are you talking about the tests added in this series? If so that means we're expecting a different behavior to what "git push" actually does. As Ben has pointed out elsewhere in this thread, if you're pushing back to a different branch on the same remote as the upstream branch you need to set `push.default=current`.Yes, it's my new tests that are breaking. Maybe it's easiest if you check out the `seen` branch which now has this logic, play with the code and run the tests to see when it breaks. I designed the feature around 'push.default=current' which I use. If we would design the feature around 'push.default=upstream' then what is the point? 🤗 Why do we need to show status for both an upstream and a push branch if we are already pushing to our upstream branch?
I'm not suggesting we design the feature around 'push.default=upstream', I'm suggesting that we design it to respect 'push.default' so it gives sensible output (i.e. something that resembles what "git push" would do) whatever the setting.
quoted
The benefit is that you get a sane interface rather that returning two different versions of the same string in two different ways (one from the function's return value and the other from a function parameter). It also matches what we do for the upstream branch.That's a good point about matching what we do for upstream branch, I'll take a look.
Thanks, I think that would be cleaner
quoted
I can't seem to see that test. If we're printing the advice once for the upstream branch and once for the default push remote I think that would be ok.This test is also part of my patch 🤗
Oh, I was looking in junio's "seen" branch from the 8th and it wasn't there. I've updated and I can see it now. I can see tests for - upstream differs from the local branch, no push branch shown - upstream and push branches differ from the local branch - upstream and push branches match the local branch I can't see a test for the local branch differing from the upstream branch when the push branch matches the local branch. As far as I can see in that case we don't show the advice when we should do (and we currently do show it)
I disagree about showing the same advice twice.
I think it is less bad than not showing it when the upstream branch does not match the local branch.
quoted
But we set show_divergance_advice to false for the push branch so there is no need to check the flag.Good point! I'll update it!
That's great Thanks Phillip
Harald