1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-06-08 05:26:11 +02:00

list-objects.c: handle unexpected non-tree entries

Apply similar treatment as the previous commit for non-tree entries,
too.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Taylor Blau 2019-04-09 19:13:19 -07:00 committed by Junio C Hamano
parent 23c204455b
commit b49e74eac4
2 changed files with 8 additions and 2 deletions

View File

@ -125,6 +125,11 @@ static void process_tree_contents(struct traversal_context *ctx,
if (S_ISDIR(entry.mode)) {
struct tree *t = lookup_tree(ctx->revs->repo, &entry.oid);
if (!t) {
die(_("entry '%s' in tree %s has tree mode, "
"but is not a tree"),
entry.path, oid_to_hex(&tree->object.oid));
}
t->object.flags |= NOT_USER_GIVEN;
process_tree(ctx, t, base, entry.path);
}

View File

@ -34,8 +34,9 @@ test_expect_failure 'traverse unexpected non-tree entry (lone)' '
test_must_fail git rev-list --objects $broken_tree
'
test_expect_failure 'traverse unexpected non-tree entry (seen)' '
test_must_fail git rev-list --objects $blob $broken_tree
test_expect_success 'traverse unexpected non-tree entry (seen)' '
test_must_fail git rev-list --objects $blob $broken_tree >output 2>&1 &&
test_i18ngrep "is not a tree" output
'
test_expect_success 'setup unexpected non-commit parent' '