@@ -37,7 +37,29 @@ def test_init_in_cwd(git2cpp_path, tmp_path, run_in_tmp_path):
3737 # TODO: check this is a valid git repo
3838
3939
40- # TODO: Test without bare flag.
40+ def test_init_not_bare (git2cpp_path , tmp_path ):
41+ # tmp_path exists and is empty.
42+ assert list (tmp_path .iterdir ()) == []
43+
44+ cmd = [git2cpp_path , 'init' , '.' ]
45+ p = subprocess .run (cmd , capture_output = True , cwd = tmp_path )
46+ assert p .returncode == 0
47+ assert p .stdout == b''
48+ assert p .stderr == b''
49+
50+ # Directory contains just .git directory.
51+ assert sorted (map (lambda path : path .name , tmp_path .iterdir ())) == ['.git' ]
52+ # .git directory is a valid repo.
53+ assert sorted (map (lambda path : path .name , (tmp_path / '.git' ).iterdir ())) == [
54+ 'HEAD' , 'config' , 'description' , 'hooks' , 'info' , 'objects' , 'refs'
55+ ]
56+
57+ # Would like to use `git2cpp status` but it complains that 'refs/heads/master' not found
58+ cmd = [git2cpp_path , 'log' ]
59+ p = subprocess .run (cmd , capture_output = True , cwd = tmp_path )
60+ assert p .returncode == 0
61+ assert p .stdout == b''
62+ assert p .stderr == b''
4163
4264
4365def test_error_on_unknown_option (git2cpp_path ):
0 commit comments