Merge branch 'jk/ignore-broken-tags-when-ignoring-missing-links' into maint
Tag objects, which are not reachable from any ref, that point at missing objects were mishandled by "git gc" and friends (they should silently be ignored instead) * jk/ignore-broken-tags-when-ignoring-missing-links: revision.c: ignore broken tags with ignore_missing_links
This commit is contained in:
commit
8d958b97c6
@ -230,7 +230,7 @@ static struct commit *handle_commit(struct rev_info *revs,
|
|||||||
die("bad tag");
|
die("bad tag");
|
||||||
object = parse_object(tag->tagged->oid.hash);
|
object = parse_object(tag->tagged->oid.hash);
|
||||||
if (!object) {
|
if (!object) {
|
||||||
if (flags & UNINTERESTING)
|
if (revs->ignore_missing_links || (flags & UNINTERESTING))
|
||||||
return NULL;
|
return NULL;
|
||||||
die("bad object %s", oid_to_hex(&tag->tagged->oid));
|
die("bad object %s", oid_to_hex(&tag->tagged->oid));
|
||||||
}
|
}
|
||||||
|
@ -129,7 +129,7 @@ for repack in '' true; do
|
|||||||
'
|
'
|
||||||
done
|
done
|
||||||
|
|
||||||
test_expect_success 'do not complain about existing broken links' '
|
test_expect_success 'do not complain about existing broken links (commit)' '
|
||||||
cat >broken-commit <<-\EOF &&
|
cat >broken-commit <<-\EOF &&
|
||||||
tree 0000000000000000000000000000000000000001
|
tree 0000000000000000000000000000000000000001
|
||||||
parent 0000000000000000000000000000000000000002
|
parent 0000000000000000000000000000000000000002
|
||||||
@ -144,4 +144,29 @@ test_expect_success 'do not complain about existing broken links' '
|
|||||||
test_must_be_empty stderr
|
test_must_be_empty stderr
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'do not complain about existing broken links (tree)' '
|
||||||
|
cat >broken-tree <<-\EOF &&
|
||||||
|
100644 blob 0000000000000000000000000000000000000003 foo
|
||||||
|
EOF
|
||||||
|
tree=$(git mktree --missing <broken-tree) &&
|
||||||
|
git gc 2>stderr &&
|
||||||
|
git cat-file -e $tree &&
|
||||||
|
test_must_be_empty stderr
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'do not complain about existing broken links (tag)' '
|
||||||
|
cat >broken-tag <<-\EOF &&
|
||||||
|
object 0000000000000000000000000000000000000004
|
||||||
|
type commit
|
||||||
|
tag broken
|
||||||
|
tagger whatever <whatever@example.com> 1234 -0000
|
||||||
|
|
||||||
|
this is a broken tag
|
||||||
|
EOF
|
||||||
|
tag=$(git hash-object -t tag -w broken-tag) &&
|
||||||
|
git gc 2>stderr &&
|
||||||
|
git cat-file -e $tag &&
|
||||||
|
test_must_be_empty stderr
|
||||||
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
Loading…
Reference in New Issue
Block a user