diff options
-rw-r--r-- | list-objects.c | 2 | ||||
-rw-r--r-- | revision.c | 2 | ||||
-rwxr-xr-x | t/t6501-freshen-objects.sh | 15 |
3 files changed, 17 insertions, 2 deletions
diff --git a/list-objects.c b/list-objects.c index 2910becd6c..90c21abc5c 100644 --- a/list-objects.c +++ b/list-objects.c @@ -81,7 +81,7 @@ static void process_tree(struct rev_info *revs, die("bad tree object"); if (obj->flags & (UNINTERESTING | SEEN)) return; - if (parse_tree(tree) < 0) { + if (parse_tree_gently(tree, revs->ignore_missing_links) < 0) { if (revs->ignore_missing_links) return; die("bad tree object %s", sha1_to_hex(obj->sha1)); diff --git a/revision.c b/revision.c index 75dda928ea..983e4c49ff 100644 --- a/revision.c +++ b/revision.c @@ -834,7 +834,7 @@ static int add_parents_to_list(struct rev_info *revs, struct commit *commit, for (parent = commit->parents; parent; parent = parent->next) { struct commit *p = parent->item; - if (parse_commit(p) < 0) + if (parse_commit_gently(p, revs->ignore_missing_links) < 0) return -1; if (revs->show_source && !p->util) p->util = commit->util; diff --git a/t/t6501-freshen-objects.sh b/t/t6501-freshen-objects.sh index 157f3f91db..2adf825076 100755 --- a/t/t6501-freshen-objects.sh +++ b/t/t6501-freshen-objects.sh @@ -129,4 +129,19 @@ for repack in '' true; do ' done +test_expect_success 'do not complain about existing broken links' ' + cat >broken-commit <<-\EOF && + tree 0000000000000000000000000000000000000001 + parent 0000000000000000000000000000000000000002 + author whatever <whatever@example.com> 1234 -0000 + committer whatever <whatever@example.com> 1234 -0000 + + some message + EOF + commit=$(git hash-object -t commit -w broken-commit) && + git gc 2>stderr && + verbose git cat-file -e $commit && + test_must_be_empty stderr +' + test_done |