Code

Merge branch 'sb/maint-1.6.0-add-config-fix' into maint
[git.git] / t / t5701-clone-local.sh
index 14413f851f3e2fac478535bd706f91bf7a5781ff..19b5c0d552fa8b4665b5e396833264e258365b28 100755 (executable)
@@ -11,7 +11,7 @@ test_expect_success 'preparing origin repository' '
        git clone --bare . x &&
        test "$(GIT_CONFIG=a.git/config git config --bool core.bare)" = true &&
        test "$(GIT_CONFIG=x/config git config --bool core.bare)" = true
-       git bundle create b1.bundle master HEAD &&
+       git bundle create b1.bundle --all &&
        git bundle create b2.bundle master &&
        mkdir dir &&
        cp b1.bundle dir/b3
@@ -116,4 +116,30 @@ test_expect_success 'bundle clone with nonexistent HEAD' '
        test ! -e .git/refs/heads/master
 '
 
+test_expect_success 'clone empty repository' '
+       cd "$D" &&
+       mkdir empty &&
+       (cd empty && git init) &&
+       git clone empty empty-clone &&
+       test_tick &&
+       (cd empty-clone
+        echo "content" >> foo &&
+        git add foo &&
+        git commit -m "Initial commit" &&
+        git push origin master &&
+        expected=$(git rev-parse master) &&
+        actual=$(git --git-dir=../empty/.git rev-parse master) &&
+        test $actual = $expected)
+'
+
+test_expect_success 'clone empty repository, and then push should not segfault.' '
+       cd "$D" &&
+       rm -fr empty/ empty-clone/ &&
+       mkdir empty &&
+       (cd empty && git init) &&
+       git clone empty empty-clone &&
+       (cd empty-clone &&
+       test_must_fail git push)
+'
+
 test_done