t1300: demonstrate that --replace-all can "invent" newlines
[gitweb.git] / t / t1700-split-index.sh
index cbcefa6e5f84a7911d5de12a5d669b4a85392299..a66936fe9bde2ba20ab0e57400b6286b0710212a 100755 (executable)
@@ -420,4 +420,23 @@ test_expect_success POSIXPERM,SANITY 'graceful handling when splitting index is
        test_cmp expected actual
 '
 
+test_expect_success 'writing split index with null sha1 does not write cache tree' '
+       git config core.splitIndex true &&
+       git config splitIndex.maxPercentChange 0 &&
+       git commit -m "commit" &&
+       {
+               git ls-tree HEAD &&
+               printf "160000 commit $_z40\\tbroken\\n"
+       } >broken-tree &&
+       echo "add broken entry" >msg &&
+
+       tree=$(git mktree <broken-tree) &&
+       test_tick &&
+       commit=$(git commit-tree $tree -p HEAD <msg) &&
+       git update-ref HEAD "$commit" &&
+       GIT_ALLOW_NULL_SHA1=1 git reset --hard &&
+       (test-dump-cache-tree >cache-tree.out || true) &&
+       test_line_count = 0 cache-tree.out
+'
+
 test_done