bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Dmitry Gutov
Subject: bug#68183: 28.3; vc-dir fails when I have a certain branch checked out
Date: Mon, 18 Mar 2024 17:26:11 +0200
User-agent: Mozilla Thunderbird

On 17/03/2024 20:09, Kรฉvin Le Gouguec wrote:

I would say that the local-tracking scenario is a minority, and so it's not as important to optimize, but the 
above makes sense. But the word "local" is very close to "master", while the latter is a 
special string which should probably somehow stand out. So the "unoptimized" version might still 
have its advantages:

       Branch:    : vc-dir-bug (tracking master)
       Remote     : none (local branch)

That looks sensible.  If I were to argue in favor of keeping "local"
juxtaposed to the tracking branch, I'd say that in the _absence_ of an
explicit qualifier in "Branch: vc-dir-bug (tracking master)", my brain
might "default" to assuming we are tracking the remote "master"; a
solution to let branch names stand out might then be faces:
e.g. vc-git-log-view-mode paints them with change-log-listโ€ฆ

But I don't know if it's a very powerful argument.

I figured that when "local" is on the next line already, it's easy enough to notice. Anyway, it's up to you, I think.

Just a thought. Not something that needs to be addressed right now. And I might 
as well be off the mark here.
I agree it's worth thinking about.  The Right Solutionโ„ข would probably
come with user options to let users fine-tune which details they care
about?  It would be interesting to survey Git UIs to see how they
approach this (FWIW I am partial to Magit's presentation, but I have not
studied how it handles all the corner cases we considered).

Magit, meaning just one line for Head: and another for Merge:?

So, given

๐’ท   โ‰” current branch
๐“‚   โ‰” branch.๐’ท.merge
๐“‡   โ‰” branch.๐’ท.remote
๐“…   โ‰” branch.๐’ท.pushRemote or remote.pushDefault

By default, magit-status shows:

"Head:"                 ๐’ท, or the current commit when detached
"Merge:" (or "Rebase:") ๐“‡/๐“‚, or just ๐“‚ if ๐“‡ = "."
"Push:"                 ๐“…/๐’ท, appending "does not exist" if applicable

So Magit also prints just "master" is it's a local tracking branch and something like "origin/master" when it belongs to a remote? Going with that approach, we'd seem justified to print

      Branch:    : vc-dir-bug (tracking master)

in the former case and

      Branch:    : vc-dir-bug (tracking origin/master)

in the latter.

(And another header related to tags I'm going to ignore for now)

Of note, Magit offers an option (magit-status-headers-hook) to let users
control which of these (and more) to display.

One of the available headers that is disabled by default shows

"Remote: โ„› <remote.โ„›.url>"

where โ„› is ๐“‡, or "origin" if this branch's remote is unset or ".", or
"the first remote in alphabetic order" if "origin" does not exist.

Meaning it prepends the remote's url with remote's name, if that line is configured to be shown. We could do that too.

(
   Also of note, IMO, is the branch-variable-configuration menu (the
   magit-branch-configure transient), which looks like this:

       Configure vc-dir-bug
        d branch.vc-dir-bug.description unset
        u branch.vc-dir-bug.merge refs/heads/master
          branch.vc-dir-bug.remote .
        r branch.vc-dir-bug.rebase [true|false|default:false]
        p branch.vc-dir-bug.pushRemote 
[hirondell|origin|savannah-rw|vps|remote.pushDefault:vps]

       Configure repository defaults
        R pull.rebase [true|false|default:false]
        P remote.pushDefault [hirondell|origin|savannah-rw|vps]
        b Update default branch

       Configure branch creation
        a m branch.autoSetupMerge [always|true|false|default:true]
        a r branch.autoSetupRebase [always|local|remote|never|default:never]
       __
   (Not pictured: the currently active value in [foo|bar|baz] is
   highlighted with a face; the keybindings on the left cycle between
   alternatives)

   No idea how/where that would fit into VC, but golly is it a neat UI to
   work with, so I thought it deserved a shout-out.
)

Magit is definitely a great UI to learn Git's capabilities.

* 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.
ACK.  I might go a head and install then (after polishing the changelog,
i.e. re-filling and scrubbing Unicode ellipses) in the spirit of getting
the original issue fixed; perhaps worth holding off on the NEWS entry
until we decide how exactly things should look.

I'm okay with that.

(Pushed ๐Ÿ“จ)

Thanks!





reply via email to

[Prev in Thread] Current Thread [Next in Thread]