GNU bug report logs - #5344
23.1.91; bug/wish: vc does not honour GIT_DIR / GIT_WORK_TREE environment variables

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: wishlist; Reported by: Gregor Zattler <grfz@HIDDEN>; dated Sat, 9 Jan 2010 01:55:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Removed tag(s) patch. Request was from Lars Ingebrigtsen <larsi@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 5344 <at> debbugs.gnu.org:


Received: (at 5344) by debbugs.gnu.org; 23 Nov 2019 13:04:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 23 08:04:01 2019
Received: from localhost ([127.0.0.1]:55938 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iYV4u-0008RU-4R
	for submit <at> debbugs.gnu.org; Sat, 23 Nov 2019 08:04:01 -0500
Received: from quimby.gnus.org ([95.216.78.240]:35688)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1iYV4h-0008Qv-1q
 for 5344 <at> debbugs.gnu.org; Sat, 23 Nov 2019 08:03:49 -0500
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=marnie)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1iYV4Y-0005Uw-3U; Sat, 23 Nov 2019 14:03:36 +0100
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Gregor Zattler <grfz@HIDDEN>
Subject: Re: bug#5344: 23.1.91; bug/wish: vc does not honour GIT_DIR /
 GIT_WORK_TREE environment variables
References: <20100109014953.GC25574@HIDDEN>
 <201001091929.o09JT9QF010981@HIDDEN>
 <20100110223940.GB4845@HIDDEN>
Date: Sat, 23 Nov 2019 14:03:33 +0100
In-Reply-To: <20100110223940.GB4845@HIDDEN> (Gregor Zattler's message
 of "Sun, 10 Jan 2010 23:39:40 +0100")
Message-ID: <87imnaoica.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  Gregor Zattler <grfz@HIDDEN> writes: > (defun vc-git-root
 (file) > - (vc-find-root file ".git")) > +(if (getenv "GIT_DIR") > + (getenv
 "GIT_WORK_TREE") > + (vc-find-root file ".git"))) As far as I can tell by
 skimming vc-git.el, functionality like this has not been added during the
 intervening years. The use case it: 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 URIBL_BLOCKED          ADMINISTRATOR NOTICE: The query to URIBL was
 blocked.  See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
 for more information. [URIs: ingebrigtsen.no]
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 5344
Cc: 5344 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Gregor Zattler <grfz@HIDDEN> writes:

>  (defun vc-git-root (file)
> -  (vc-find-root file ".git"))
> +(if (getenv "GIT_DIR") 
> +  (getenv "GIT_WORK_TREE")
> + (vc-find-root file ".git")))

As far as I can tell by skimming vc-git.el, functionality like this has
not been added during the intervening years.  The use case it:

> I use bare git repositories for version contol of some dotfiles.[1] This
> means that the repository ist *not* in a .git directory which is part of
> the working directorys hirarchy.  Instead the environment variable
> GIT_DIR indicates the location of the repository and the environment
> variable GIT_WORK_TREE indicates the working directory.

We wouldn't want to add this in the form suggested above, but it does
sound like a useful feature, if I understand it correctly.  But I don't
quite see how you'd tie a specific location to a specific GIT_DIR value,
so I don't see how this would work in general.  Perhaps fall back on
GIT_DIR/GIR_WORK_TREE if vc-git-root returns nil would be reasonable?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#5344; Package emacs. Full text available.
Added tag(s) patch. Request was from Stefan Kangas <stefan@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Severity set to 'wishlist' from 'normal' Request was from Glenn Morris <rgm@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 5344 <at> debbugs.gnu.org:


Received: (at 5344) by debbugs.gnu.org; 11 Jan 2010 00:14:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 10 19:14:03 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1NU7v0-0003ED-UX
	for submit <at> debbugs.gnu.org; Sun, 10 Jan 2010 19:14:03 -0500
Received: from mail.gmx.net ([213.165.64.20])
	by debbugs.gnu.org with smtp (Exim 4.69)
	(envelope-from <error4me@HIDDEN>) id 1NU6Sj-00025e-Vt
	for 5344 <at> debbugs.gnu.org; Sun, 10 Jan 2010 17:40:47 -0500
Received: (qmail invoked by alias); 10 Jan 2010 22:40:41 -0000
Received: from p57B9FEE1.dip.t-dialin.net (EHLO shi.workgroup) [87.185.254.225]
	by mail.gmx.net (mp051) with SMTP; 10 Jan 2010 23:40:41 +0100
X-Authenticated: #19296480
X-Provags-ID: V01U2FsdGVkX18KhfEXHBEKqQlXazhyOOUQ354wcYIEG3GxsWiyuo
	tI6+5gAF+vkBwn
Received: from grfz by shi.workgroup with local (Exim 4.71)
	(envelope-from <error4me@HIDDEN>)
	id 1NU6S0-00030E-UY; Sun, 10 Jan 2010 23:40:00 +0100
Date: Sun, 10 Jan 2010 23:39:40 +0100
From: Gregor Zattler <grfz@HIDDEN>
To: Dan Nicolaescu <dann@HIDDEN>
Subject: Re: bug#5344: 23.1.91; bug/wish: vc does not honour GIT_DIR /
	GIT_WORK_TREE environment variables
Message-ID: <20100110223940.GB4845@HIDDEN>
References: <20100109014953.GC25574@HIDDEN>
	<201001091929.o09JT9QF010981@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <201001091929.o09JT9QF010981@HIDDEN>
User-Agent: Mutt/1.5.20 (2009-06-14)
X-Y-GMX-Trusted: 0
X-FuHaFi: 0.57
X-Spam-Score: -3.4 (---)
X-Debbugs-Envelope-To: 5344
X-Mailman-Approved-At: Sun, 10 Jan 2010 19:14:01 -0500
Cc: 5344 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -3.3 (---)

tags patch
thanks

Hi Dan,
* Dan Nicolaescu <dann@HIDDEN> [09. Jan. 2010]:
> If you want to add support for this, it's quite likely that the only
> thing that needs to be changed is the vc-git-root in
> emacs/lisp/vc-git.el.

O.K. thanks to your pointer this was really easy.  I don't know
if there are negative side effects or if it's a complete solution
to the problem but it works for me.  The patch does not normalize
the resulting path, though.  Don't know if this is a problem.
For instance (vc-git-root "~/.emacs.d/init.el") gives me:
"/home/grfz/.fgits/emacs.git/../../"

I don't know if other version controll systems have similar means
of detaching repository and working directory.  Then vc-find-root
would perhaps be a better place to patch.  But thats beyond me.

Thank you *very* much.

Now I have to learn how to use emacsclients environment for this
purpose instead of the daemon ones.

Gregor


--- vc-git.el	2010-01-10 22:51:23.000000000 +0100
+++ my-vc-git.el	2010-01-10 23:24:55.000000000 +0100
@@ -777,7 +777,9 @@
 (defun vc-git-extra-status-menu () vc-git-extra-menu-map)
 
 (defun vc-git-root (file)
-  (vc-find-root file ".git"))
+(if (getenv "GIT_DIR") 
+  (getenv "GIT_WORK_TREE")
+ (vc-find-root file ".git")))
 
 (defun vc-git-toggle-signoff ()
   (interactive)




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#5344; Package emacs. Full text available.

Message received at 5344 <at> debbugs.gnu.org:


Received: (at 5344) by debbugs.gnu.org; 10 Jan 2010 12:16:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 10 07:16:41 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1NTwim-0001Zv-Kz
	for submit <at> debbugs.gnu.org; Sun, 10 Jan 2010 07:16:41 -0500
Received: from mail.gmx.net ([213.165.64.20])
	by debbugs.gnu.org with smtp (Exim 4.69)
	(envelope-from <error4me@HIDDEN>) id 1NTvu1-000183-Fv
	for 5344 <at> debbugs.gnu.org; Sun, 10 Jan 2010 06:24:14 -0500
Received: (qmail invoked by alias); 10 Jan 2010 11:24:08 -0000
Received: from p57B9FEE1.dip.t-dialin.net (EHLO shi.workgroup) [87.185.254.225]
	by mail.gmx.net (mp006) with SMTP; 10 Jan 2010 12:24:08 +0100
X-Authenticated: #19296480
X-Provags-ID: V01U2FsdGVkX19a61s8l3haR0m2KfY1RBO5PsAVLIPwqAa2ytYHok
	0BlrxU73ugrPlM
Received: from grfz by shi.workgroup with local (Exim 4.71)
	(envelope-from <error4me@HIDDEN>)
	id 1NTvtL-0002MS-Pa; Sun, 10 Jan 2010 12:23:31 +0100
Date: Sun, 10 Jan 2010 12:23:11 +0100
From: Gregor Zattler <grfz@HIDDEN>
To: Dan Nicolaescu <dann@HIDDEN>
Subject: Re: bug#5344: 23.1.91; bug/wish: vc does not honour GIT_DIR /
	GIT_WORK_TREE environment variables
Message-ID: <20100110112311.GA8553@HIDDEN>
References: <20100109014953.GC25574@HIDDEN>
	<201001091929.o09JT9QF010981@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <201001091929.o09JT9QF010981@HIDDEN>
User-Agent: Mutt/1.5.20 (2009-06-14)
X-Y-GMX-Trusted: 0
X-FuHaFi: 0.61
X-Spam-Score: -4.3 (----)
X-Debbugs-Envelope-To: 5344
X-Mailman-Approved-At: Sun, 10 Jan 2010 07:16:39 -0500
Cc: 5344 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -3.7 (---)

Hi Dan,
* Dan Nicolaescu <dann@HIDDEN> [09. Jan. 2010]:
> Gregor Zattler <grfz@HIDDEN> writes:
>   > I use bare git repositories for version contol of some dotfiles.[1] This
>   > means that the repository ist *not* in a .git directory which is part of
>   > the working directorys hirarchy.  Instead the environment variable
>   > GIT_DIR indicates the location of the repository and the environment
>   > variable GIT_WORK_TREE indicates the working directory.  But in emacs/vc
>   > these dotfiles do not show up as version controlled, even when the emacs
>   > session inherited the correct GIT_* environment variables:
>   > 
>   >    ~$ export GIT_DIR=~/.fgits/emacs.git
>   >    ~$ export GIT_WORK_TREE="$GIT_DIR/$(git config --get core.worktree)"
>   >    ~$ printenv|grep GIT
>   >    GIT_DIR=/home/grfz/.fgits/emacs.git
>   >    GIT_WORK_TREE=/home/grfz/.fgits/emacs.git/../../
> 
> If you want to add support for this, it's quite likely that the only
> thing that needs to be changed is the vc-git-root in
> emacs/lisp/vc-git.el.

Sorry I'm not capable to do this.  That's the reason I called it
a wish list bug.

Because of your suggestion I have fiddled around a bit and found
a workaround which somehow supports your suggestion::

I initilalised an empty repository ~/.git.  Now vc "considers"
my whole home directory as potentially version controlled and
interacts with git.  Git in turn honours the environment
variables and voila:  many of the vc-commands are working now.
Since I do not want to use this ~/.git I did a 
   chmod -R a-w ~/.git
in order to prevent accidentially using this repository in stead
of one of the detached ones.


Thanks for the hint.
Gregor




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#5344; Package emacs. Full text available.

Message received at 5344 <at> debbugs.gnu.org:


Received: (at 5344) by debbugs.gnu.org; 9 Jan 2010 19:29:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jan 09 14:29:22 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1NTgzy-0003hE-7h
	for submit <at> debbugs.gnu.org; Sat, 09 Jan 2010 14:29:22 -0500
Received: from colin-baker-v0.ics.uci.edu ([128.195.1.153])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <dann@HIDDEN>) id 1NTgzw-0003h9-0N
	for 5344 <at> debbugs.gnu.org; Sat, 09 Jan 2010 14:29:20 -0500
Received: from godzilla.ics.uci.edu (godzilla.ics.uci.edu [128.195.10.101])
	by colin-baker-v0.ics.uci.edu (8.13.8/8.13.8) with ESMTP id
	o09JT9kV028533
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Sat, 9 Jan 2010 11:29:09 -0800
Received: (from dann@localhost)
	by godzilla.ics.uci.edu (8.13.8+Sun/8.13.6/Submit) id o09JT9QF010981;
	Sat, 9 Jan 2010 11:29:09 -0800 (PST)
Date: Sat, 9 Jan 2010 11:29:09 -0800 (PST)
Message-Id: <201001091929.o09JT9QF010981@HIDDEN>
From: Dan Nicolaescu <dann@HIDDEN>
To: Gregor Zattler <grfz@HIDDEN>
Subject: Re: bug#5344: 23.1.91;
	bug/wish: vc does not honour GIT_DIR / GIT_WORK_TREE environment
	variables
References: <20100109014953.GC25574@HIDDEN>
X-Debbugs-No-Ack: yes
In-Reply-To: <20100109014953.GC25574@HIDDEN> (Gregor Zattler's message
	of "Sat, 9 Jan 2010 02:49:53 +0100")
Lines: 21
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-ICS-MailScanner-Information: Please send mail to helpdesk@HIDDEN or
	more information
X-ICS-MailScanner-ID: o09JT9kV028533
X-ICS-MailScanner: Found to be clean
X-ICS-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-1.44, 
	required 5, autolearn=disabled, ALL_TRUSTED -1.44)
X-ICS-MailScanner-From: dann@HIDDEN
X-Spam-Status: No
X-Spam-Score: -2.5 (--)
X-Debbugs-Envelope-To: 5344
Cc: 5344 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.6 (--)

Gregor Zattler <grfz@HIDDEN> writes:

  > Dear emacs developers,
  > 
  > I use bare git repositories for version contol of some dotfiles.[1] This
  > means that the repository ist *not* in a .git directory which is part of
  > the working directorys hirarchy.  Instead the environment variable
  > GIT_DIR indicates the location of the repository and the environment
  > variable GIT_WORK_TREE indicates the working directory.  But in emacs/vc
  > these dotfiles do not show up as version controlled, even when the emacs
  > session inherited the correct GIT_* environment variables:
  > 
  >    ~$ export GIT_DIR=~/.fgits/emacs.git
  >    ~$ export GIT_WORK_TREE="$GIT_DIR/$(git config --get core.worktree)"
  >    ~$ printenv|grep GIT
  >    GIT_DIR=/home/grfz/.fgits/emacs.git
  >    GIT_WORK_TREE=/home/grfz/.fgits/emacs.git/../../

If you want to add support for this, it's quite likely that the only
thing that needs to be changed is the vc-git-root in
emacs/lisp/vc-git.el.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#5344; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 9 Jan 2010 01:54:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 08 20:54:03 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1NTQWg-0001Y8-K1
	for submit <at> debbugs.gnu.org; Fri, 08 Jan 2010 20:54:03 -0500
Received: from fencepost.gnu.org ([140.186.70.10])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <error4me@HIDDEN>) id 1NTQTi-0001WG-CS
	for submit <at> debbugs.gnu.org; Fri, 08 Jan 2010 20:51:01 -0500
Received: from mail.gnu.org ([199.232.76.166]:44140 helo=mx10.gnu.org)
	by fencepost.gnu.org with esmtp (Exim 4.69)
	(envelope-from <error4me@HIDDEN>) id 1NTQTe-0001uz-QF
	for emacs-pretest-bug@HIDDEN; Fri, 08 Jan 2010 20:50:54 -0500
Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim
	4.60) (envelope-from <error4me@HIDDEN>) id 1NTQTb-0005Rm-IW
	for emacs-pretest-bug@HIDDEN; Fri, 08 Jan 2010 20:50:54 -0500
X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on monty-python
X-Spam-Level: 
X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00 autolearn=ham 
	version=3.1.0
Received: from mail.gmx.net ([213.165.64.20]:48539)
	by monty-python.gnu.org with smtp (Exim 4.60)
	(envelope-from <error4me@HIDDEN>) id 1NTQTa-0005Qt-SF
	for emacs-pretest-bug@HIDDEN; Fri, 08 Jan 2010 20:50:51 -0500
Received: (qmail invoked by alias); 09 Jan 2010 01:50:46 -0000
Received: from p57B9F42E.dip.t-dialin.net (EHLO shi.workgroup) [87.185.244.46]
	by mail.gmx.net (mp018) with SMTP; 09 Jan 2010 02:50:46 +0100
X-Authenticated: #19296480
X-Provags-ID: V01U2FsdGVkX18oXpUGzd0ogmWz06asSDQx3X2Aj5BdDasUSdvm2r
	0GwTgb+TUqLwWf
Received: from grfz by shi.workgroup with local (Exim 4.71)
	(envelope-from <error4me@HIDDEN>)
	id 1NTQSz-0001LX-EM; Sat, 09 Jan 2010 02:50:13 +0100
Date: Sat, 9 Jan 2010 02:49:53 +0100
From: Gregor Zattler <grfz@HIDDEN>
To: emacs-pretest-bug@HIDDEN
Subject: 23.1.91; bug/wish: vc does not honour GIT_DIR / GIT_WORK_TREE
	environment variables
Message-ID: <20100109014953.GC25574@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.20 (2009-06-14)
X-Y-GMX-Trusted: 0
X-FuHaFi: 0.42
X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not
	recognized.
X-Spam-Score: -5.9 (-----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Fri, 08 Jan 2010 20:54:01 -0500
Cc: rfrancoise@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -5.9 (-----)

Dear emacs developers,

I use bare git repositories for version contol of some dotfiles.[1] This
means that the repository ist *not* in a .git directory which is part of
the working directorys hirarchy.  Instead the environment variable
GIT_DIR indicates the location of the repository and the environment
variable GIT_WORK_TREE indicates the working directory.  But in emacs/vc
these dotfiles do not show up as version controlled, even when the emacs
session inherited the correct GIT_* environment variables:

   ~$ export GIT_DIR=~/.fgits/emacs.git
   ~$ export GIT_WORK_TREE="$GIT_DIR/$(git config --get core.worktree)"
   ~$ printenv|grep GIT
   GIT_DIR=/home/grfz/.fgits/emacs.git
   GIT_WORK_TREE=/home/grfz/.fgits/emacs.git/../../

There are several files/directories under ~/.emacs.d, but *no* .git
directory::

   ~$ ls .emacs.d/
   ~/.emacs.d$ ls -A
   _abbrev_defs      _backup  elpa         _emms-history  history
   init.el            _recentf           todo-top
   _abbrev_defs.old  _diary   _emacs.bmk   games          _ido.last
   lisp               _remember_backups  update-org.sh
   auto-save-list    elisp    _emacs_orig  _gnus
   image-dired  .org-id-locations  todo-do

There is also no ~/.git

   ~/$ ls -l ~/.git
   ls: cannot access /home/grfz/.git: No such file or directory

but git works fine:

   cd ~/.emacs.d

   ~/.emacs.d$ git status
   # On branch master
   # Changed but not updated:
   #   (use "git add <file>..." to update what will be committed)
   #   (use "git checkout -- <file>..." to discard changes in
   #   working directory)
   #
   #       modified:   init.el
   #
   no changes added to commit (use "git add" and/or "git commit -a")

Or:

   ~/.emacs.d$ git log -n 1
   commit ffa6f03211b7234533d060886614b96ea59c30f0
   Author: Gregor Zattler <telegraph@HIDDEN>
   Date:   Thu Jan 7 22:38:23 2010 +0100
   
       new german aspell directory name; show max buffer size; minor
       changes
   

This are the files in ~/.emacs.d which are version controlled:

   ~/.emacs.d$ git ls-files
   _abbrev_defs
   _diary
   _gnus
   init.el

Now I start emacs:

   emacs -Q -n 

and evaluate

   (getenv "GIT_DIR")

this shows 

   "/home/grfz/.fgits/emacs.git"

in the echo area, while 

   (getenv "GIT_WORK_TREE")

gives

   "/home/grfz/.fgits/emacs.git/../../"

That's o.k.  Now I ^X f visit ~/.emacs.d/init.el but no
indication that init.el is version controlled shows up in the
mode line: 

   -UUU:----F1  init.el        Top L1     (Emacs-Lisp)----------------------------------------------------------

Now I type ^X v d (vc-dir), emacs asks 

   VC status for directory: ~/.emacs.d/

when I confirm this, I get the message

   No VC backend is responsible for /home/grfz/.emacs.d/

in the echo area.



vc does not support the specific git feature of detatched repositories.  
Therefore I file this bugreport / wishlist bug:  IMHO vc should
support this feature.  In order to do so vc should honour the
environment variables GIT_DIR and GIT_WORK_TREE respectively and
utilize the git ls-files directory.  git gives
precedence to these environment variables: even if there is a
.git directory with reository it will be ignored if the
environment variables indicate other locations for repository and
working directory.  I think vc should behave in the same way.




Thanx for your attention, 
Gregor

[1] 
These "fake bare repos" are created like this:
   export GIT_DIR=~/.fgits/emacs.git 
   git init --bare 
   git config core.bare false 
   git config core.worktree ../../ 
   git config status.showUntrackedFiles no
see http://lists.madduck.net/pipermail/vcs-home/2008-August/000175.html
for an explanation of this way of keeping dotfiles under version
control. 



If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
For information about debugging Emacs, please read the file
/usr/share/emacs/23.1.91/etc/DEBUG.


In GNU Emacs 23.1.91.1 (i486-pc-linux-gnu, GTK+ Version 2.18.5)
 of 2010-01-06 on elegiac, modified by Debian
 (emacs-snapshot package, version 1:20100106-1)
Windowing system distributor `The X.Org Foundation', version 11.0.10605000
configured using `configure  '--build' 'i486-linux-gnu' '--host' 'i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/23.1.91/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1.91/site-lisp:/usr/share/emacs/site-lisp' '--with-x=yes' '--with-x-toolkit=gtk' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -DSITELOAD_PURESIZE_EXTRA=5000 -g -O2' 'LDFLAGS=-g -Wl,--as-needed' 'CPPFLAGS=''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: de_DE.utf8
  value of $LC_CTYPE: de_DE.utf8
  value of $LC_MESSAGES: POSIX
  value of $LC_MONETARY: de_DE.utf8
  value of $LC_NUMERIC: de_DE.utf8
  value of $LC_TIME: de_DE.utf8
  value of $LANG: de_DE.utf8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
( g e t e n v SPC " G I T _ D I R " ) C-x C-e <return> 
M-x e m a <tab> b <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> r e 
p o <tab> r <tab> <return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
"/home/grfz/.fgits/emacs.git"
Making completion list...

Load-path shadows:
/usr/share/emacs/23.1.91/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs/23.1.91/site-lisp/emms/tq hides /usr/share/emacs/23.1.91/lisp/emacs-lisp/tq

Features:
(shadow sort mail-extr message sendmail regexp-opt ecomplete rfc822 mml
mml-sec password-cache mm-decode mm-bodies mm-encode mailcap mail-parse
rfc2231 rfc2047 rfc2045 qp ietf-drums mailabbrev nnheader gnus-util
netrc time-date mm-util mail-prsvr gmm-utils wid-edit mailheader canlock
sha1 hex-util hashcash mail-utils emacsbug help-mode easymenu view
tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd
font-setting tool-bar dnd fontset image fringe lisp-mode register page
menu-bar rfn-eshadow timer select scroll-bar mldrag mouse jit-lock
font-lock syntax facemenu font-core frame cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew
greek romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev loaddefs button
minibuffer faces cus-face files text-properties overlay md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process dbusbind font-render-setting gtk
x-toolkit x multi-tty emacs)




Acknowledgement sent to Gregor Zattler <grfz@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#5344; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

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