From: Avery Pennarun Date: Wed, 6 Jan 2010 02:41:07 +0000 (-0500) Subject: Older git needs 'git --bare init' instead of 'git init --bare' X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=222fff0b3f4e8d0d19c75f26e2a0412764ccff37;p=packages%2Fb%2Fbup.git Older git needs 'git --bare init' instead of 'git init --bare' Needed in at least 1.5.4 (Ubuntu Hardy), but not 1.5.6 (Debian Lenny). --- diff --git a/cmd-init.py b/cmd-init.py index 3febc73..effaac4 100755 --- a/cmd-init.py +++ b/cmd-init.py @@ -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 cd61eb8..a7e81c5 100644 --- 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):