diff options
author | Jeff King <peff@peff.net> | 2019-12-18 14:25:46 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-01-23 21:51:50 +0300 |
commit | 92fb0db94c54da06e8573f8bc2f92d1f757bd7f0 (patch) | |
tree | 1bf54a1621f014f26ea9eff4e126d38e946568fe /pack-bitmap.h | |
parent | bb514de356cfcfd314f7ac7ae1acfeede3fa4b1f (diff) |
pack-objects: add checks for duplicate objects
Additional checks are added in have_duplicate_entry() and
obj_is_packed() to avoid duplicate objects in the reuse
bitmap. It was probably buggy to not have such a check
before.
Git as a client would never both asks for a tag by sha1 and
specify "include-tag", but libgit2 will, so a libgit2 client
cloning from a Git server would trigger the bug.
If a client both asks for a tag by sha1 and specifies
"include-tag", we may end up including the tag in the reuse
bitmap (due to the first thing), and then later adding it to
the packlist (due to the second). This results in duplicate
objects in the pack, which git chokes on. We should notice
that we are already including it when doing the include-tag
portion, and avoid adding it to the packlist.
The simplest place to fix this is right in add_ref_tag(),
where we could avoid peeling the tag at all if we know that
we are already including it. However, this pushes the check
instead into have_duplicate_entry(). This fixes not only
this case, but also means that we cannot have any similar
problems lurking in other code.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pack-bitmap.h')
0 files changed, 0 insertions, 0 deletions