GNU bug report logs - #23769
25.0.95; Mode Line breakage in vc-git

Previous Next

Package: emacs;

Reported by: phillip.lord <at> russet.org.uk (Phillip Lord)

Date: Tue, 14 Jun 2016 11:17:01 UTC

Severity: normal

Found in version 25.0.95

Done: Dmitry Gutov <dgutov <at> yandex.ru>

Bug is archived. No further changes may be made.

Full log


Message #14 received at 23769 <at> debbugs.gnu.org (full text, mbox):

From: phillip.lord <at> russet.org.uk (Phillip Lord)
To: Glenn Morris <rgm <at> gnu.org>
Cc: 23769 <at> debbugs.gnu.org
Subject: Re: bug#23769: 25.0.95; Mode Line breakage in vc-git
Date: Tue, 14 Jun 2016 22:30:27 +0100
Glenn Morris <rgm <at> gnu.org> writes:

> AFAIK Emacs doesn't support GIT_DIR, see eg https://debbugs.gnu.org/5344 .

I think I have tracked the cause of the problem.

It happens if a test opens a file in a subdirectory of the git root.
When the file is opened Emacs checks to see whether the file is
versioned. Somewhere down the line Emacs calls vc-git-working-revision,
which eventually results in invocation of `git symbolic-ref HEAD`.
All is good.

Unless, GIT_DIR is set to ".git". Now, `git symbolic-ref HEAD` fails in
subdirectories because GIT_DIR is still set to .git, when the .git
directory is in the root. git symbolic-ref fails with 128 "Fatal: Not a
git repository".

Unfortunately, this is exactly the situation on a pre-commit hook. Git
changes working directory to the root of the git repository, and then
sets GIT_DIR to be .git.

Potential solutions:

1) Ignore return values from git (fail silently)
2) Unset GIT_DIR (but I don't know why it is set by git, and I assume it
   is for some reason)
3) Run all vc-git commands from the root dir, and use fully qualified
   names.

Will think further.

Phil




This bug report was last modified 8 years and 336 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.