From 20618650058741117d909e086c2e78c003e5cfcd Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 21 Mar 2007 13:05:30 +0100 Subject: [PATCH] Make it possible to invoke git-p4 from within subdirectories of a git working tree. Signed-off-by: Simon Hausmann --- contrib/fast-import/git-p4.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contrib/fast-import/git-p4.py b/contrib/fast-import/git-p4.py index a07534058..f940e93ba 100755 --- a/contrib/fast-import/git-p4.py +++ b/contrib/fast-import/git-p4.py @@ -925,6 +925,10 @@ parser = optparse.OptionParser(cmd.usage.replace("%prog", "%prog " + cmdName), 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"): -- 2.30.2