Subject: Re: bug#59257: 29.0.50;vc-git-mode-line-string out of range

From: Uwe Brauer <[email-masked]>
Date: Tue, 15 Nov 2022 08:28:51 +0100

> Uwe Brauer <[email-masked]> writes:

> It seems like `vc-git--symbolic-ref' returns nil when it shouldn't?

> I think the attached patch will stop the backtrace from happening, but
> it's more of a workaround:

Thanks, I will test it and report back if you find anything strange. 

Since I only use git very occasionally I have no idea 
why this error pops up and what it means.

> diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
> index a1ff03144b..ae3cada3d7 100644
> --- a/lisp/vc/vc-git.el
> +++ b/lisp/vc/vc-git.el
> @@ -391,7 +391,7 @@ vc-git-mode-line-string
>    "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)
> -                       (and rev (substring rev 0 7))))
> +                       (and rev (string-limit rev 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)))

-- 
Warning: Content may be disturbing to some audiences
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the ban of Russia from SWIFT.
I support the EU membership of the Ukraine. 
https://addons.thunderbird.net/en-US/thunderbird/addon/gmail-conversation-view/