mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-09 18:22:16 +00:00
indexer: don't worry about duplicate objects
If a packfile includes duplicate objects, we can choose to use the secon copy instead of the first by using the same logic as if it were the first. Change the error condition from 0 to -1, which indicates a bad resize, and set the OOM message in that case. This does mean we will leak the first copy of the object. We can deal with that later, but making fetches work is more important.
This commit is contained in:
parent
a34692c419
commit
dccf59ad38
@ -287,9 +287,9 @@ static int store_object(git_indexer *idx)
|
|||||||
pentry->offset = entry_start;
|
pentry->offset = entry_start;
|
||||||
|
|
||||||
k = kh_put(oid, idx->pack->idx_cache, &pentry->sha1, &error);
|
k = kh_put(oid, idx->pack->idx_cache, &pentry->sha1, &error);
|
||||||
if (!error) {
|
if (error == -1) {
|
||||||
git__free(pentry);
|
git__free(pentry);
|
||||||
giterr_set(GITERR_INDEXER, "cannot handle duplicate objects in pack");
|
giterr_set_oom();
|
||||||
goto on_error;
|
goto on_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user