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 <barkalow@iabervon.org> Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Shawn O. Pearce committed
Feb 11, 2009 at 10:15 UTC
fa3a0c94dc88567b513e58835e5915f87da40af9
1 file changed
+1
sha1_file.c
+1
@@ -676,6 +676,7 @@ void free_pack_by_name(const char *pack_name)
676
while (*pp) {
677
p = *pp;
678
if (strcmp(pack_name, p->pack_name) == 0) {
679
+ clear_delta_base_cache();
680
close_pack_windows(p);
681
if (p->pack_fd != -1)
682
close(p->pack_fd);