summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorLibravatar Simon Hausmann <hausmann@kde.org>2007-03-19 11:57:07 +0100
committerLibravatar Simon Hausmann <hausmann@kde.org>2007-03-19 11:57:10 +0100
commit09e16455e028ae264347067a8c86a7b9a1e5889c (patch)
treee84c2f569f4d5b96d605ab33b21e51f9872d9556 /contrib
parentDefault to interactive syncing (diff)
downloadtgif-09e16455e028ae264347067a8c86a7b9a1e5889c.tar.xz
Improved the git dir detection.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/fast-import/p4-git-sync.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/contrib/fast-import/p4-git-sync.py b/contrib/fast-import/p4-git-sync.py
index ed88debd45..5a3bf90485 100755
--- a/contrib/fast-import/p4-git-sync.py
+++ b/contrib/fast-import/p4-git-sync.py
@@ -37,6 +37,11 @@ def die(msg):
sys.stderr.write(msg + "\n")
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:
opts, args = getopt.getopt(sys.argv[1:], "", [ "continue", "git-dir=", "origin=", "reset", "master=",
"submit-log-subst=", "log-substitutions=", "noninteractive",
@@ -86,6 +91,14 @@ if len(gitdir) == 0:
else:
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"
origin = "origin"