Fix calling git-p4 rebase from within a subdirectory (git rebase wants to be in toplevel)
[gitweb.git] / contrib / fast-import / git-p4
index c48b257577f22bf7872a11fadfe659fc66802970..ca6c62380990268a77a54bc7655c055445469b94 100755 (executable)
@@ -1197,6 +1197,8 @@ if cmd.needsGit:
         gitdir = ".git"
         if not isValidGitDir(gitdir):
             gitdir = mypopen("git rev-parse --git-dir").read()[:-1]
+            if os.path.exists(gitdir):
+                os.chdir(mypopen("git rev-parse --show-cdup").read()[:-1]);
 
     if not isValidGitDir(gitdir):
         if isValidGitDir(gitdir + "/.git"):