Make it possible to invoke git-p4 from within subdirectories of a git working tree.

Signed-off-by: Simon Hausmann <hausmann@kde.org>
This commit is contained in:
Simon Hausmann 2007-03-21 13:05:30 +01:00
parent 1932a6ac7c
commit 2061865005

View File

@ -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"):