Subject: Re: bug#68183: 28.3; vc-dir fails when I have a certain branch checked out

From: Dmitry Gutov <[email-masked]>
Date: Fri, 15 Mar 2024 04:57:08 +0200

Hi!

Sorry about the late reply.

It seems like you've done a fair amount of testing, both manual and 
automated - thanks, more tests are welcome.

On 14/02/2024 21:56, Kévin Le Gouguec wrote:
> And here's another revision, addressing most of the points below.
> WDY'allT?
> 
>> * the test should probably have a (skip-unless (have-git-or-something)),
> Done.
> 
>> * maybe "none (tracking local branch)" is not informative and we should
>>    ditch it,
>>    * maybe we should fall back to "origin", like vc-git-repository-url
>>      does,
> FWIW, the current patch will show
> 
>      Branch     : vc-dir-tracking-branch
>      Tracking   : origin/master
>      Remote     :https://git.savannah.gnu.org/git/emacs.git
> 
> for my checkout of this work-in-progress patch, and
> 
>      Branch     : vc-dir-bug
>      Tracking   : master
>      Remote     : none (tracking local branch)
> 
> for a checkout made following Tom's recipe, and
> 
>      Branch     : trunk
> 
> for a fresh 'git init' with just a default branch.

IIUC you're adding the new "Tracking" header to the output? That seems 
like it should be helpful.

Is there a way that we could/should optimize the display? I.e., I guess 
the most common case will be something like:

       Branch     : foo-bar
       Tracking   : origin/foo-bar

which is not bad, but might be less useful than indicating that the 
current branch does not track anything (and so the next 'git push' 
should come with '-u'), or tracks a differently named branch. It might 
be more ergonomic to emphasize "irregular" scenarios and maybe even save 
on the extra line in the "common" one.

Just a thought. Not something that needs to be addressed right now. And 
I might as well be off the mark here.

> OT1H "none (tracking local branch)" is redundant with "Tracking" not
> being prefixed with "origin"; OTOH
> 
> * stripping "Remote" altogether might confuse users - at least "tracking
>    local branch" hints at what's going on,
> 
> * Falling back to origin's URL might also cause confusion: users might
>    then expect 'vc-pull' to fetch changes from that URL, which is not the
>    case.

That seems fine.

> So all in all I think the above is reasonably useful.
> 
>> * rushed the ChangeLog entry; vc-git-test--run should also be declared
>>    as a "new helper" (and maybe I should spell out that I used it to not
>>    have to depend on vc-git-- internal functions),
> Done.
> 
>> * maybe the new header deserves a NEWS entry.
> Maybe?

It wouldn't hurt. Up to you.

Anyway, I think the patch is good to go. Please feel free to install it; 
whatever cosmetic changes we might like to add could be done later.