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

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

bug#5344: 23.1.91; bug/wish: vc does not honour GIT_DIR / GIT_WORK_TREE


From: Gregor Zattler
Subject: 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
User-agent: Mutt/1.5.20 (2009-06-14)

tags patch
thanks

Hi Dan,
* Dan Nicolaescu <dann@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)






reply via email to

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