[Top][All Lists]

[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: Sat, 9 Jan 2010 02:49:53 +0100
User-agent: Mutt/1.5.20 (2009-06-14)

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

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

   ~$ 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")


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

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

   ~/.emacs.d$ git ls-files

Now I start emacs:

   emacs -Q -n 

and evaluate

   (getenv "GIT_DIR")

this shows 


in the echo area, while 

   (getenv "GIT_WORK_TREE")



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     

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, 

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

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

In GNU Emacs (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' 
 '--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.
Making completion list...

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

(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)

reply via email to

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