I had this bug pop up again, after having been away for many months. Dmitry Gutov writes: > Kevin Brubeck Unhammer 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 repo I've seen it with under ~ if that makes any difference (ie. ~/.git) – I can't remember if I've seen it other places. >> 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? Yes. I followed the calls a bit more this time and (vc-git--out-ok "rev-parse" "HEAD") also gives nil, while (apply 'vc-git--call '(t nil) "rev-parse" "HEAD") gives 128; this is the return value of (apply 'process-file "git" nil '(t nil) nil "rev-parse" '("HEAD")) When I keep stderr by doing (apply 'process-file "git" nil '(t nil) nil "rev-parse" '("HEAD")) I get fatal: Not a git repository: .git Notably, this only happens with files that are in subdirectories of ~ (but still tracked by the ~ repo), not with files that are directly inside ~. E.g. it happens with ~/org/gtd.org, but not with ~/.gitignore. Also, I've never seen that exact error message from git before. I've seen fatal: Not a git repository (or any of the parent directories): .git and fatal: Not a git repository (or any parent up to mount point /tmp) but only from this emacs bug have I seen the no-parenthesis fatal: Not a git repository: .git When I restarted emacs to see if it had anything to do with my init.el, the bug was gone again. -- Kevin Brubeck Unhammer GPG: 0x766AC60C