From 97c093470e2cd5f968422be938b2086d07e68757 Mon Sep 17 00:00:00 2001 From: Tommi Virtanen Date: Sat, 1 Sep 2007 18:27:25 -0700 Subject: Add gitosis-init, for bootstrapping a new installation. --- gitosis/test/test_repository.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'gitosis/test/test_repository.py') diff --git a/gitosis/test/test_repository.py b/gitosis/test/test_repository.py index 79d1561..9d22d0a 100644 --- a/gitosis/test/test_repository.py +++ b/gitosis/test/test_repository.py @@ -6,6 +6,7 @@ import subprocess from gitosis import repository from gitosis.test.util import mkdir, maketemp, readFile, check_mode +from gitosis.test.util import assert_raises def check_bare(path): # we want it to be a bare repository @@ -102,3 +103,30 @@ Frobitz the quux and eschew obfuscation. eq(got[5], '') eq(got[6], 'Frobitz the quux and eschew obfuscation.') eq(got[7:], []) + +def test_has_initial_commit_fail_notAGitDir(): + tmp = maketemp() + e = assert_raises( + repository.GitRevParseError, + repository.has_initial_commit, + git_dir=tmp) + eq(str(e), 'rev-parse failed: exit status 128') + +def test_has_initial_commit_no(): + tmp = maketemp() + repository.init(path=tmp) + got = repository.has_initial_commit(git_dir=tmp) + eq(got, False) + +def test_has_initial_commit_yes(): + tmp = maketemp() + repository.init(path=tmp) + repository.fast_import( + git_dir=tmp, + commit_msg='fakecommit', + committer='John Doe ', + files=[], + ) + got = repository.has_initial_commit(git_dir=tmp) + eq(got, True) + -- cgit v1.2.3