diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-05-16 02:51:50 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-05-16 02:51:50 (GMT) |
commit | f767178a5ada848867a7378053897bdfbac32590 (patch) | |
tree | 5a6a8f49b53dd52fc5e31bdb6a67105642399d93 /t | |
parent | d97141b0b94ae0206ac25ed6334709b18f98f186 (diff) | |
parent | a96d3cc3f65285f7d51c30fb3f630202b5347a57 (diff) | |
download | git-f767178a5ada848867a7378053897bdfbac32590.zip git-f767178a5ada848867a7378053897bdfbac32590.tar.gz git-f767178a5ada848867a7378053897bdfbac32590.tar.bz2 |
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-x | t/t1601-index-bogus.sh | 22 | ||||
-rwxr-xr-x | t/t7009-filter-branch-null-sha1.sh | 6 |
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 0000000..73cc932 --- /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 c27f90f..a8d9ec4 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 \ |