diff options
author | David Aguilar <davvid@gmail.com> | 2008-06-12 03:01:09 -0700 |
---|---|---|
committer | David Aguilar <davvid@gmail.com> | 2008-06-12 03:01:09 -0700 |
commit | abc2e538c6f2fe50f93e6c3fe927236bb41f94f4 (patch) | |
tree | 1f350705bb60063f073092f22799c09b1731bf51 /lib/git/cmd.py | |
parent | 52654c0216dcbe3fa2d9afb1de12c65d18f6a7a4 (diff) | |
download | gitpython-abc2e538c6f2fe50f93e6c3fe927236bb41f94f4.tar.gz |
cmd: properly handle cwd for repos with work trees
This is a fix on top of Govind's latest performance improvement.
self._cwd was always set to self._git_dir which means
a lot of commands that require work trees were not available
to GitPython. Execute now uses self._cwd which is equal to
self._git_dir by default, and self.get_work_tree() if a work tree
exists.
Signed-off-by: David Aguilar <davvid@gmail.com>
Diffstat (limited to 'lib/git/cmd.py')
-rw-r--r-- | lib/git/cmd.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/git/cmd.py b/lib/git/cmd.py index 55e81e78..d3a7e36b 100644 --- a/lib/git/cmd.py +++ b/lib/git/cmd.py @@ -24,6 +24,9 @@ class Git(MethodMissingMixin): self._git_dir = None self._is_in_repo = not not self.get_git_dir() self._work_tree = None + self._cwd = self._git_dir + if self._git_dir: + self._cwd = self.get_work_tree() def _is_git_dir(self, d): """ This is taken from the git setup.c:is_git_directory @@ -115,7 +118,7 @@ class Git(MethodMissingMixin): # Start the process proc = subprocess.Popen(command, - cwd=self._git_dir, + cwd=self._cwd, stdin=istream, stderr=stderr, stdout=subprocess.PIPE |