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

Previous Next

Package: emacs;

Reported by: Gregor Zattler <grfz <at> gmx.de>

Date: Sat, 9 Jan 2010 01:55:02 UTC

Severity: wishlist

Full log


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

From: Gregor Zattler <grfz <at> gmx.de>
To: Dan Nicolaescu <dann <at> ics.uci.edu>
Cc: 5344 <at> debbugs.gnu.org
Subject: Re: bug#5344: 23.1.91; bug/wish: vc does not honour GIT_DIR /
	GIT_WORK_TREE environment variables
Date: Sun, 10 Jan 2010 23:39:40 +0100
tags patch
thanks

Hi Dan,
* Dan Nicolaescu <dann <at> ics.uci.edu> [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)




This bug report was last modified 5 years and 195 days ago.

Previous Next


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