]> arthur.barton.de Git - bup.git/blobdiff - cmd/init-cmd.py
README.md: mention workaround for pwd test issue
[bup.git] / cmd / init-cmd.py
index 04f32484d6bd78a6ad2c37022e5ac8af6cedd6a8..2e4a1513b99c058a1fec43ba0e62091d3ed2158d 100755 (executable)
@@ -1,23 +1,29 @@
 #!/usr/bin/env python
+import sys
+
 from bup import git, options, client
 from bup.helpers import *
 
+
 optspec = """
 [BUP_DIR=...] bup init [-r host:path]
 --
 r,remote=  remote repository path
 """
-o = options.Options('bup init', optspec)
+o = options.Options(optspec)
 (opt, flags, extra) = o.parse(sys.argv[1:])
 
 if extra:
     o.fatal("no arguments expected")
 
 
-if opt.remote:
+try:
     git.init_repo()  # local repo
+except git.GitError, e:
+    log("bup: error: could not init repository: %s" % e)
+    sys.exit(1)
+
+if opt.remote:
     git.check_repo_or_die()
     cli = client.Client(opt.remote, create=True)
     cli.close()
-else:
-    git.init_repo()