[Top][All Lists]

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

master 38a62ef: Make vc-git-mode-line-string more robust

From: Lars Ingebrigtsen
Subject: master 38a62ef: Make vc-git-mode-line-string more robust
Date: Wed, 21 Jul 2021 17:58:05 -0400 (EDT)

branch: master
commit 38a62efc15ddd849219ef1bdc98da933b5b1c33c
Author: Yan Gajdos <yan@gajdos.info>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Make vc-git-mode-line-string more robust
    * lisp/vc/vc-git.el (vc-git-mode-line-string): Make function more
    robust (bug#49683).  It could previously error out under certain
    conditions, like moving directories in and out of the
    VC-controlled tree.
    Copyright-paperwork-exempt: yes
 lisp/vc/vc-git.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 89f9800..5828a83 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -375,7 +375,7 @@ in the order given by `git status'."
   "Return a string for `vc-mode-line' to put in the mode line for FILE."
   (let* ((rev (vc-working-revision file 'Git))
          (disp-rev (or (vc-git--symbolic-ref file)
-                       (substring rev 0 7)))
+                       (and rev (substring rev 0 7))))
          (def-ml (vc-default-mode-line-string 'Git file))
          (help-echo (get-text-property 0 'help-echo def-ml))
          (face   (get-text-property 0 'face def-ml)))

reply via email to

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