summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2017-05-16 11:51:50 +0900
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-05-16 11:51:50 +0900
commitf767178a5ada848867a7378053897bdfbac32590 (patch)
tree5a6a8f49b53dd52fc5e31bdb6a67105642399d93 /t
parentMerge branch 'dt/raise-core-packed-git-limit' (diff)
parentcache-tree: reject entries with null sha1 (diff)
downloadtgif-f767178a5ada848867a7378053897bdfbac32590.tar.xz
Merge branch 'jk/no-null-sha1-in-cache-tree'
Code to update the cache-tree has been tightened so that we won't accidentally write out any 0{40} entry in the tree object. * jk/no-null-sha1-in-cache-tree: cache-tree: reject entries with null sha1
Diffstat (limited to 't')
-rwxr-xr-xt/t1601-index-bogus.sh22
-rwxr-xr-xt/t7009-filter-branch-null-sha1.sh6
2 files changed, 28 insertions, 0 deletions
diff --git a/t/t1601-index-bogus.sh b/t/t1601-index-bogus.sh
new file mode 100755
index 0000000000..73cc9323cd
--- /dev/null
+++ b/t/t1601-index-bogus.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+test_description='test handling of bogus index entries'
+. ./test-lib.sh
+
+test_expect_success 'create tree with null sha1' '
+ tree=$(printf "160000 commit $_z40\\tbroken\\n" | git mktree)
+'
+
+test_expect_success 'read-tree refuses to read null sha1' '
+ test_must_fail git read-tree $tree
+'
+
+test_expect_success 'GIT_ALLOW_NULL_SHA1 overrides refusal' '
+ GIT_ALLOW_NULL_SHA1=1 git read-tree $tree
+'
+
+test_expect_success 'git write-tree refuses to write null sha1' '
+ test_must_fail git write-tree
+'
+
+test_done
diff --git a/t/t7009-filter-branch-null-sha1.sh b/t/t7009-filter-branch-null-sha1.sh
index c27f90f285..a8d9ec4987 100755
--- a/t/t7009-filter-branch-null-sha1.sh
+++ b/t/t7009-filter-branch-null-sha1.sh
@@ -31,6 +31,12 @@ test_expect_success 'setup: bring HEAD and index in sync' '
git commit -a -m "back to normal"
'
+test_expect_success 'noop filter-branch complains' '
+ test_must_fail git filter-branch \
+ --force --prune-empty \
+ --index-filter "true"
+'
+
test_expect_success 'filter commands are still checked' '
test_must_fail git filter-branch \
--force --prune-empty \