bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#23769: 25.0.95; Mode Line breakage in vc-git


From: Phillip Lord
Subject: bug#23769: 25.0.95; Mode Line breakage in vc-git
Date: Tue, 14 Jun 2016 22:30:27 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.95 (gnu/linux)

Glenn Morris <rgm@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





reply via email to

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