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

From: Kévin Le Gouguec <[email-masked]>
Date: Wed, 21 Aug 2024 09:05:50 +0200

Sean Whitton <[email-masked]> writes:

> Hello,
>
> On Wed 21 Aug 2024 at 03:42am +03, Dmitry Gutov wrote:
>
>> NEWS for emacs-30 sounds good, 

(ACK'ing Eli's request to submit here for review before pushing 👌)

>>                                and I've pushed the other two changes (tests
>> and refactoring) to the master branch.

(Thanks!)

> Hang on, I think Kevin hadn't incorporated my requested changes into
> that version :)

(Right, I've been less reactive than ideal these past few days,
apologies for that)

> Kevin, could you provide a follow-up patch, please?  Thanks.

Something like the attached, right?  Tested manually with a rebase.

>From beb4fd8874fb4c03ce2b8b789bcb7a4b7ee411b7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= <[email-masked]>
Date: Wed, 21 Aug 2024 08:45:00 +0200
Subject: [PATCH] Restore vc-git helper function (bug#68183)

* lisp/vc/vc-git.el (vc-git--cmds-in-progress): Restore; it was
removed in a previous refactoring patch, but we may still find
some use for it.
(vc-git-dir--in-progress-headers): Use it.
---
 lisp/vc/vc-git.el | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 4d631c7e032..dedf6fdd219 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -748,8 +748,8 @@ or an empty string if none."
                    (and tracking (fmt "Tracking" tracking))
                    (and remote-url (fmt "Remote" remote-url)))))))
 
-(defun vc-git-dir--in-progress-headers ()
-  "Return headers for Git commands in progress in this worktree."
+(defun vc-git--cmds-in-progress ()
+  "Return a list of Git commands in progress in this worktree."
   (let ((gitdir (vc-git--git-path))
         cmds)
     ;; See contrib/completion/git-prompt.sh in git.git.
@@ -765,6 +765,11 @@ or an empty string if none."
       (push 'merge cmds))
     (when (file-exists-p (expand-file-name "BISECT_START" gitdir))
       (push 'bisect cmds))
+    cmds))
+
+(defun vc-git-dir--in-progress-headers ()
+  "Return headers for Git commands in progress in this worktree."
+  (let ((cmds (vc-git--cmds-in-progress)))
     (cl-flet ((fmt (cmd name)
                 (when (memq cmd cmds)
                   ;; For now just a heading, key bindings can be added
-- 
2.39.2