Improved the git dir detection.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
This commit is contained in:
parent
228d36c92b
commit
09e16455e0
@ -37,6 +37,11 @@ def die(msg):
|
|||||||
sys.stderr.write(msg + "\n")
|
sys.stderr.write(msg + "\n")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
def tryGitDir(path):
|
||||||
|
if os.path.exists(path + "/HEAD") and os.path.exists(path + "/refs") and os.path.exists(path + "/objects"):
|
||||||
|
return True;
|
||||||
|
return False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
opts, args = getopt.getopt(sys.argv[1:], "", [ "continue", "git-dir=", "origin=", "reset", "master=",
|
opts, args = getopt.getopt(sys.argv[1:], "", [ "continue", "git-dir=", "origin=", "reset", "master=",
|
||||||
"submit-log-subst=", "log-substitutions=", "noninteractive",
|
"submit-log-subst=", "log-substitutions=", "noninteractive",
|
||||||
@ -86,6 +91,14 @@ if len(gitdir) == 0:
|
|||||||
else:
|
else:
|
||||||
os.environ["GIT_DIR"] = gitdir
|
os.environ["GIT_DIR"] = gitdir
|
||||||
|
|
||||||
|
if not tryGitDir(gitdir):
|
||||||
|
if tryGitDir(gitdir + "/.git"):
|
||||||
|
gitdir += "/.git"
|
||||||
|
os.environ["GIT_DIR"] = gitdir
|
||||||
|
else:
|
||||||
|
die("fatal: %s seems not to be a git repository." % gitdir)
|
||||||
|
|
||||||
|
|
||||||
configFile = gitdir + "/p4-git-sync.cfg"
|
configFile = gitdir + "/p4-git-sync.cfg"
|
||||||
|
|
||||||
origin = "origin"
|
origin = "origin"
|
||||||
|
Loading…
Reference in New Issue
Block a user