Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Improved the git dir detection.
author
Simon Hausmann
<hausmann@kde.org>
Mon, 19 Mar 2007 10:57:07 +0000
(11:57 +0100)
committer
Simon Hausmann
<hausmann@kde.org>
Mon, 19 Mar 2007 10:57:10 +0000
(11:57 +0100)
Signed-off-by: Simon Hausmann <hausmann@kde.org>
contrib/fast-import/p4-git-sync.py
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
228d36c
)
diff --git
a/contrib/fast-import/p4-git-sync.py
b/contrib/fast-import/p4-git-sync.py
index ed88debd4599ec1ed88a7872f1aa574e454f7435..5a3bf90485ddecc28fd9b19b393969a65d35c455 100755
(executable)
--- 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)
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",
try:
opts, args = getopt.getopt(sys.argv[1:], "", [ "continue", "git-dir=", "origin=", "reset", "master=",
"submit-log-subst=", "log-substitutions=", "noninteractive",
@@
-86,6
+91,14
@@
def die(msg):
else:
os.environ["GIT_DIR"] = gitdir
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"
configFile = gitdir + "/p4-git-sync.cfg"
origin = "origin"