changeset 13093:d0cbddfe3f4c

subrepo: use subprocess's cwd instead of git's --work-tree Some older git commands (e.g. git merge) do not properly recognize the --work-tree argument, so abstract that away from git.
author Eric Eisner <ede@mit.edu>
date Mon, 06 Dec 2010 21:17:27 -0500
parents 83986af605e5
children a1dd7bd26a2b
files mercurial/subrepo.py
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/subrepo.py	Mon Dec 06 21:17:27 2010 -0500
+++ b/mercurial/subrepo.py	Mon Dec 06 21:17:27 2010 -0500
@@ -617,11 +617,10 @@
         return self._gitdir(commands, stream=stream)[0]
 
     def _gitdir(self, commands, stream=False):
-        commands = ['--no-pager', '--git-dir=%s/.git' % self._path,
-                    '--work-tree=%s' % self._path] + commands
-        return self._gitnodir(commands, stream=stream)
+        commands = ['--no-pager'] + commands
+        return self._gitnodir(commands, stream=stream, cwd=self._path)
 
-    def _gitnodir(self, commands, stream=False):
+    def _gitnodir(self, commands, stream=False, cwd=None):
         """Calls the git command
 
         The methods tries to call the git command. versions previor to 1.6.0
@@ -632,7 +631,7 @@
         cmd = util.quotecommand(' '.join(cmd))
 
         # print git's stderr, which is mostly progress and useful info
-        p = subprocess.Popen(cmd, shell=True, bufsize=-1,
+        p = subprocess.Popen(cmd, shell=True, bufsize=-1, cwd=cwd,
                              close_fds=util.closefds,
                              stdout=subprocess.PIPE)
         if stream: