Permalink
Browse files

add a test for "Do not crash when cloning HEAD-less repo" with empty.…

…git test data

Conflicts:
	dulwich/tests/test_repository.py

Signed-Off-By: Jelmer Vernooij <jelmer@samba.org>
  • Loading branch information...
D-Key authored and jelmer committed Aug 3, 2012
1 parent 99274d9 commit dfe7b678cfaee4cdc524f961bdf1a6fcf71c74ce
@@ -0,0 +1 @@
+ref: refs/heads/master
@@ -0,0 +1,7 @@
+[core]
+ repositoryformatversion = 0
+ filemode = false
+ bare = true
+ symlinks = false
+ ignorecase = true
+ hideDotFiles = dotGitOnly
@@ -0,0 +1,2 @@
+*
+!.gitignore
@@ -0,0 +1,2 @@
+*
+!.gitignore
@@ -0,0 +1,2 @@
+*
+!.gitignore
@@ -0,0 +1,2 @@
+*
+!.gitignore
@@ -303,6 +303,19 @@ def test_clone_no_head(self):
'b0931cadc54336e78a1d980420e3268903b57a50',
}, t.refs.as_dict())
+ def test_clone_empty(self):
+ """Test clone() doesn't crash if HEAD points to a non-existing ref.
+
+ This simulates cloning server-side bare repository either when it is
+ still empty or if user renames master branch and pushes private repo
+ to the server.
+ Non-bare repo HEAD always points to an existing ref.
+ """
+ r = self._repo = open_repo('empty.git')
+ tmp_dir = tempfile.mkdtemp()
+ self.addCleanup(shutil.rmtree, tmp_dir)
+ r.clone(tmp_dir, mkdir=False, bare=True)
+
def test_merge_history(self):
r = self._repo = open_repo('simple_merge.git')
shas = [e.commit.id for e in r.get_walker()]

0 comments on commit dfe7b67

Please sign in to comment.