]> arthur.barton.de Git - bup.git/commitdiff
Older git needs 'git --bare init' instead of 'git init --bare'
authorAvery Pennarun <apenwarr@gmail.com>
Wed, 6 Jan 2010 02:41:07 +0000 (21:41 -0500)
committerAvery Pennarun <apenwarr@gmail.com>
Wed, 6 Jan 2010 02:41:07 +0000 (21:41 -0500)
Needed in at least 1.5.4 (Ubuntu Hardy), but not 1.5.6 (Debian Lenny).

cmd-init.py
git.py

index 3febc73134bd0e00634a994f5964603e7557aa71..effaac4a09cbc0f2b919fe1f6e325ee45248a125 100755 (executable)
@@ -20,6 +20,5 @@ if opt.remote:
     git.check_repo_or_die()
     cli = client.Client(opt.remote, create=True)
     cli.close()
-    exit(0)  # if close() didn't throw an exception
 else:
-    exit(git.init_repo())
+    git.init_repo()
diff --git a/git.py b/git.py
index cd61eb8db21858d7d460445420728568d81df398..a7e81c5c3f0b4afbfb9f5551b84db1385a9fb5cd 100644 (file)
--- a/git.py
+++ b/git.py
@@ -320,9 +320,11 @@ def init_repo(path=None):
     d = repo()
     if os.path.exists(d) and not os.path.isdir(os.path.join(d, '.')):
         raise GitError('"%d" exists but is not a directory\n' % d)
-    p = subprocess.Popen(['git', 'init', '--bare'], stdout=sys.stderr,
+    p = subprocess.Popen(['git', '--bare', 'init'], stdout=sys.stderr,
                          preexec_fn = _gitenv)
-    return p.wait()
+    rv = p.wait()
+    if rv != 0:
+        raise GitError('git init returned %d\n' % rv)
 
 
 def check_repo_or_die(path=None):