From: phillip.lord@russet.org.uk (Phillip Lord)
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: 23769@debbugs.gnu.org
Subject: bug#23769: 25.0.95; Mode Line breakage in vc-git
Date: Wed, 15 Jun 2016 23:09:48 +0100 [thread overview]
Message-ID: <871t3y85oz.fsf@russet.org.uk> (raw)
In-Reply-To: <9856a1e4-be41-d781-bfbd-22bac360d18b@yandex.ru> (Dmitry Gutov's message of "Thu, 16 Jun 2016 00:02:12 +0300")
Dmitry Gutov <dgutov@yandex.ru> writes:
> On 06/15/2016 11:48 PM, Phillip Lord wrote:
>
>> I've noticed from instrumenting vc-git that it's not just the
>> symbolic-ref command that returns 128, but several others. So, it might
>> be that the best long term solution would be to make change vc-git--call
>> to set the default directory to the root, which would make GIT_DIR=.git
>> always correct.
>
> The patch looks wrong. Why does the problem script set GIT_DIR to '.git'?
Try it on a pre-commit hook. CWD is set to the root, and GIT_DIR is set
to .git. Other people have found this:
http://longair.net/blog/2011/04/09/missing-git-hooks-documentation/
AFAICT, it's not actually documented by git. Or it is but the
documentation is incomprehensible (hey, it's git, it could happen!).
> In all examples I've found, this variable is set to an absolute value. In
> general, its purpose, it seems, is to point to the '.git' directory when it's
> named otherwise and/or is situated somewhere outside of the current directory
> tree.
>
> The latter situation will break vc-git-root.
That situation does indeed happen. For example, I normally checkout
emacs into worktrees where you get this when commiting on emacs-25
branch which is a worktree off master.
/home/phillord/src/git/emacs-git/master/.git/worktrees/emacs-25
But in this case, I think vc-git-root will still work.
(defun vc-git-root (file)
(or (vc-file-getprop file 'git-root)
(vc-file-setprop file 'git-root (vc-find-root file ".git"))))
We still find ".git" because it is a *file* (not a directory) at the top
level of a worktree.
> As such, the submitted patch is only likely to work in the
> tautological case you've descried.
It's definately a risk. Git does many things, and people use it in many
ways.
> And it will add some performance penalty to each call, because
> vc-git-root, though usually fast, is not free.
Not free, but it is a constant time look up after the first.
There is a simpler option. I am trying to solve the root cause of the
problem but, as you say, that might be fraught. Since the problem only
seems to cause an error with vc-git-mode-line-string, we could just
discard the error from vc-git-working-revision in this case.
Failing that, now I know what the problem is, at least I have a
workaround (unset GIT_DIR in the pre-commit hook).
Phil
next prev parent reply other threads:[~2016-06-15 22:09 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-14 11:16 bug#23769: 25.0.95; Mode Line breakage in vc-git Phillip Lord
2016-06-14 16:29 ` Glenn Morris
2016-06-14 17:03 ` Phillip Lord
2016-06-14 21:52 ` Dmitry Gutov
2016-06-14 22:21 ` Phillip Lord
2016-06-15 20:48 ` Phillip Lord
2016-06-15 21:02 ` Dmitry Gutov
2016-06-15 22:09 ` Phillip Lord [this message]
2016-06-15 22:27 ` Noam Postavsky
2016-06-15 23:20 ` Dmitry Gutov
2016-06-16 7:11 ` Phillip Lord
2016-06-16 7:45 ` Phillip Lord
2016-06-15 23:25 ` Dmitry Gutov
2016-06-16 7:41 ` Phillip Lord
2016-06-16 11:25 ` Dmitry Gutov
2016-06-16 16:06 ` Dmitry Gutov
2016-06-16 16:54 ` Noam Postavsky
2016-06-16 16:59 ` Dmitry Gutov
2016-06-16 21:47 ` Phillip Lord
2016-06-16 22:13 ` Dmitry Gutov
2016-06-16 22:23 ` Phillip Lord
2016-06-16 22:31 ` Dmitry Gutov
2016-06-16 22:42 ` Phillip Lord
2016-06-17 2:41 ` Dmitry Gutov
2016-06-17 3:37 ` Noam Postavsky
2016-06-17 6:54 ` Eli Zaretskii
2016-06-17 12:06 ` Dmitry Gutov
2016-06-17 13:21 ` Eli Zaretskii
2016-06-17 13:54 ` Dmitry Gutov
2016-06-17 15:09 ` Phillip Lord
2016-06-16 21:47 ` Phillip Lord
2016-06-16 22:04 ` Dmitry Gutov
2016-06-21 16:46 ` Dmitry Gutov
2016-06-21 20:45 ` Phillip Lord
2016-06-21 23:06 ` Dmitry Gutov
2016-06-15 21:56 ` John Wiegley
2016-06-14 21:30 ` Phillip Lord
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871t3y85oz.fsf@russet.org.uk \
--to=phillip.lord@russet.org.uk \
--cc=23769@debbugs.gnu.org \
--cc=dgutov@yandex.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).