[RFC][PATCH] Remove wrong usage of GIT_DIR
- From: Vincent Legoll <vincent legoll gmail com>
- To: meld-list <meld-list gnome org>, j_r_fonseca yahoo co uk, aaron bentley utoronto ca, stevek gnome org
- Subject: [RFC][PATCH] Remove wrong usage of GIT_DIR
- Date: Sat, 4 Apr 2009 19:49:25 +0200
According to git documentation:
http://www.kernel.org/pub/software/scm/git/docs/
[...]
GIT_DIR
If the GIT_DIR environment variable is set then it specifies a
path to use instead of the default .git for the base of the
repository.
GIT_WORK_TREE
Set the path to the working tree. The value will not be used in
combination with repositories found automatically in a .git directory
(i.e. $GIT_DIR is not set). This can also be controlled by the
--work-tree command line option and the core.worktree configuration
variable.
[...]
and testing with git command line client:
/.../tmp/git$ cd .git
/.../tmp/git/.git$ git status --untracked-files
fatal: This operation must be run in a work tree
the usage we make of GIT_DIR environment variable in git.py is wrong
this environment variable is not pointing to a vc.root directory.
$ cd /tmp
$ mkdir gitrepo
$ mkdir gitwc
$ export GIT_DIR=`pwd`/gitrepo
$ cd gitwc
$ git init
Initialized empty Git repository in /tmp/gitrepo/
$ ls -la
total 8.0K
drwxr-xr-x 2 vince vince 4.0K 2009-04-04 19:43 .
drwxr-xr-x 4 vince vince 4.0K 2009-04-04 19:43 ..
$ ~/dev/svn/meld/trunk/meld .
fatal: This operation must be run in a work tree
Someone motivated could add proper handling of git
environment variable back.
--
Vincent Legoll
Index: vc/git.py
===================================================================
--- vc/git.py (revision 1326)
+++ vc/git.py (working copy)
@@ -41,14 +41,7 @@
def __init__(self, location):
self._tree_cache = None
- try:
- _vc.Vc.__init__(self, location)
- except ValueError:
- gitdir = os.environ.get("GIT_DIR")
- if gitdir and os.path.isdir(gitdir):
- self.root = gitdir
- return
- raise ValueError()
+ _vc.Vc.__init__(self, location)
def commit_command(self, message):
return [self.CMD,"commit","-m",message]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]