Subject: Re: bug#18788: 24.4; vc-git-working-revision vs mode-line gives error

From: Dmitry Gutov <[email-masked]>
Date: Sun, 14 Dec 2014 13:15:18 +0200

Kevin Brubeck Unhammer <[email-masked]> writes:

> Whenever I try to save a git-registered file under emacs 24.4, I get
>
>     apply: Args out of range: #("Git@" 0 4 (help-echo "Locally added
>     file under the Git version control system")), 0, 7

I don't see that.

Does that happen in a bare session (started with `emacs -Q')?

Is there anything special about the repository, or its current local state?

> The function vc-git-mode-line-string tries to get the revision using
> vc-working-revision, which returns nil. Instead of checking the `rev'
> variable for nil, it checks `detached', before calling substring. It
> should probably do
>
>     (if (and detached rev)
>         (substring …) 
>      …)
>
> instead. I don't know why vc-working-revision returns nil though
> (there's a whole lot of indirection to dig through there).

Does (vc-git-working-revision buffer-file-name) return nil in the same buffer?