Basically an alias for git init, but uses BUP_DIR instead of GIT_DIR
environment variable.
bup-split
bup-join
bup-save
+bup-init
randomgen
*.o
*.so
default: all
-all: bup-split bup-join bup-save bup randomgen chashsplit.so
+all: bup-split bup-join bup-save bup-init bup randomgen chashsplit.so
randomgen: randomgen.o
clean:
rm -f *.o *.so *~ .*~ *.pyc */*.pyc */*~ \
- bup bup-split bup-join bup-save randomgen \
+ bup bup-split bup-join bup-save bup-init randomgen \
out[12] out2[tc] tags[12] tags2[tc] *.tmp
--- /dev/null
+#!/usr/bin/env python
+import git, options
+from helpers import *
+
+optspec = """
+[BUP_DIR=...] bup init
+"""
+o = options.Options('bup init', optspec)
+(opt, flags, extra) = o.parse(sys.argv[1:])
+
+if extra:
+ log("bup init: no arguments expected\n")
+ o.usage()
+
+exit(git.init_repo())
+
preexec_fn = _gitenv)
p.wait()
return newval
+
+
+def init_repo():
+ d = repodir()
+ if os.path.exists(d) and not os.path.isdir(os.path.join(d, '.')):
+ raise Exception('"%d" exists but is not a directory\n' % d)
+ p = subprocess.Popen(['git', 'init', '--bare'],
+ preexec_fn = _gitenv)
+ return p.wait()