Make it possible to invoke git-p4 from within subdirectories of a git working tree.
authorSimon Hausmann <hausmann@kde.org>
Wed, 21 Mar 2007 12:05:30 +0000 (13:05 +0100)
committerSimon Hausmann <hausmann@kde.org>
Wed, 21 Mar 2007 12:05:30 +0000 (13:05 +0100)
Signed-off-by: Simon Hausmann <hausmann@kde.org>
contrib/fast-import/git-p4.py
index a07534058c5af91ac879b16d5021f1150eeb5391..f940e93bad1db606f128acd601b5d271f8e0a1ed 100755 (executable)
@@ -925,6 +925,10 @@ def printUsage(commands):
 gitdir = cmd.gitdir
 if len(gitdir) == 0:
     gitdir = ".git"
 gitdir = cmd.gitdir
 if len(gitdir) == 0:
     gitdir = ".git"
+    if not isValidGitDir(gitdir):
+        cdup = os.popen("git-rev-parse --show-cdup").read()[:-1]
+        if isValidGitDir(cdup + "/" + gitdir):
+            os.chdir(cdup)
 
 if not isValidGitDir(gitdir):
     if isValidGitDir(gitdir + "/.git"):
 
 if not isValidGitDir(gitdir):
     if isValidGitDir(gitdir + "/.git"):