From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: phillip.lord@russet.org.uk (Phillip Lord) Newsgroups: gmane.emacs.bugs Subject: bug#23769: 25.0.95; Mode Line breakage in vc-git Date: Wed, 15 Jun 2016 23:09:48 +0100 Message-ID: <871t3y85oz.fsf@russet.org.uk> References: <87a8ioyq9o.fsf@russet.org.uk> <87wplr1z4z.fsf@russet.org.uk> <91e61a46-b3bb-c4d9-cb30-bbfa90135d69@yandex.ru> <877fdqkwki.fsf@russet.org.uk> <9856a1e4-be41-d781-bfbd-22bac360d18b@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1466028688 30822 80.91.229.3 (15 Jun 2016 22:11:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 15 Jun 2016 22:11:28 +0000 (UTC) Cc: 23769@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jun 16 00:11:17 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bDJ1o-0003vG-OJ for geb-bug-gnu-emacs@m.gmane.org; Thu, 16 Jun 2016 00:11:17 +0200 Original-Received: from localhost ([::1]:45334 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDJ1k-0004pd-Gw for geb-bug-gnu-emacs@m.gmane.org; Wed, 15 Jun 2016 18:11:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48504) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDJ1f-0004pA-3e for bug-gnu-emacs@gnu.org; Wed, 15 Jun 2016 18:11:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bDJ1a-0005Hh-4Y for bug-gnu-emacs@gnu.org; Wed, 15 Jun 2016 18:11:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:58561) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDJ1a-0005Hd-17 for bug-gnu-emacs@gnu.org; Wed, 15 Jun 2016 18:11:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bDJ1Z-0003BR-TD for bug-gnu-emacs@gnu.org; Wed, 15 Jun 2016 18:11:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: phillip.lord@russet.org.uk (Phillip Lord) Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 15 Jun 2016 22:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23769 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 23769-submit@debbugs.gnu.org id=B23769.146602860412156 (code B ref 23769); Wed, 15 Jun 2016 22:11:01 +0000 Original-Received: (at 23769) by debbugs.gnu.org; 15 Jun 2016 22:10:04 +0000 Original-Received: from localhost ([127.0.0.1]:42665 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bDJ0a-00039c-EM for submit@debbugs.gnu.org; Wed, 15 Jun 2016 18:10:04 -0400 Original-Received: from cloud103.planethippo.com ([31.216.48.48]:40865) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bDJ0V-00039J-9D for 23769@debbugs.gnu.org; Wed, 15 Jun 2016 18:09:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=russet.org.uk; s=default; h=Content-Type:MIME-Version:Message-ID: In-Reply-To:Date:References:Subject:Cc:To:From; bh=UHaM0LUr3zmZeZiRAp3kuyjttnBjrLkUkJ97Vt84Juc=; b=kQD8GJdYTAP5vJZd9xn8i21S2z LpJWyMcjb4s9jQDypxJWZ3nHLjvxwIcS4KPBY3J5WLNfLiQLR7oiNdcV9mddrtxf72NUMZGou/CXh vG+COC+UtHMss35jUvLnPW8fVDDTUvnj0HUpCEx/8rFW8Hx7pSkw70QHPNsD4C+MsHqIBCMEwSxh2 P1V7/0AEMGf5JUMa0Am0a8fxNqX1PCIDM+327Gl8FSXmzQmVRzHciAGcMeoiumge225/TYSMb7/7K 4RA1hpkRE07FC+T8v1eccUmOH1S4S8MlExnef288vGRgu7Ypv7hgw0noqtwXIEnlTZ0iQ0CEAILgc 2afmiuaQ==; Original-Received: from cpc1-benw10-2-0-cust373.gate.cable.virginm.net ([77.98.219.118]:46521 helo=russet.org.uk) by cloud103.planethippo.com with esmtpsa (TLSv1.2:DHE-RSA-AES128-SHA:128) (Exim 4.86_1) (envelope-from ) id 1bDJ0P-003APa-4E; Wed, 15 Jun 2016 23:09:49 +0100 In-Reply-To: <9856a1e4-be41-d781-bfbd-22bac360d18b@yandex.ru> (Dmitry Gutov's message of "Thu, 16 Jun 2016 00:02:12 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.95 (gnu/linux) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - cloud103.planethippo.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - russet.org.uk X-Get-Message-Sender-Via: cloud103.planethippo.com: authenticated_id: phillip.lord@russet.org.uk X-Authenticated-Sender: cloud103.planethippo.com: phillip.lord@russet.org.uk X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:119604 Archived-At: Dmitry Gutov 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