Skip to content

Commit fa3a0c9

Browse files
spearcegitster
authored andcommitted
Clear the delta base cache if a pack is rebuilt
There is some risk that re-opening a regenerated pack file with different offsets could leave stale entries within the delta base cache that could be matched up against other objects using the same "struct packed_git*" and pack offset. Throwing away the entire delta base cache in this case is safer, as we don't have to worry about a recycled "struct packed_git*" matching to the wrong base object, resulting in delta apply errors while unpacking an object. Suggested-by: Daniel Barkalow <[email protected]> Signed-off-by: Shawn O. Pearce <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3d20c63 commit fa3a0c9

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

sha1_file.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,7 @@ void free_pack_by_name(const char *pack_name)
676676
while (*pp) {
677677
p = *pp;
678678
if (strcmp(pack_name, p->pack_name) == 0) {
679+
clear_delta_base_cache();
679680
close_pack_windows(p);
680681
if (p->pack_fd != -1)
681682
close(p->pack_fd);

0 commit comments

Comments
 (0)