diff options
author | Taylor Blau <me@ttaylorr.com> | 2019-04-10 05:13:17 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-04-10 06:59:39 +0300 |
commit | 23c204455bf2198806e8c7b0cd86b20a50a379d0 (patch) | |
tree | 53bcb4f59c3793bd98ecbe24206121a3b6561f10 /t/t6102-rev-list-unexpected-objects.sh | |
parent | 0616617c7e1470e11c10dcb0fb72100ce3b15ec4 (diff) |
list-objects.c: handle unexpected non-blob entries
Fix one of the cases described in the previous commit where a tree-entry
that is promised to a blob is in fact a non-blob.
When 'lookup_blob()' returns NULL, it is because Git has cached the
requested object as a non-blob. In this case, prevent a SIGSEGV by
'die()'-ing immediately before attempting to dereference the result.
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t6102-rev-list-unexpected-objects.sh')
-rwxr-xr-x | t/t6102-rev-list-unexpected-objects.sh | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/t/t6102-rev-list-unexpected-objects.sh b/t/t6102-rev-list-unexpected-objects.sh index 15072ecce3..1377c60378 100755 --- a/t/t6102-rev-list-unexpected-objects.sh +++ b/t/t6102-rev-list-unexpected-objects.sh @@ -20,8 +20,9 @@ test_expect_failure 'traverse unexpected non-blob entry (lone)' ' test_must_fail git rev-list --objects $broken_tree ' -test_expect_failure 'traverse unexpected non-blob entry (seen)' ' - test_must_fail git rev-list --objects $tree $broken_tree +test_expect_success 'traverse unexpected non-blob entry (seen)' ' + test_must_fail git rev-list --objects $tree $broken_tree >output 2>&1 && + test_i18ngrep "is not a blob" output ' test_expect_success 'setup unexpected non-tree entry' ' |