Skip to content

Commit

Permalink
Clear the delta base cache if a pack is rebuilt
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Shawn O. Pearce authored and Junio C Hamano committed Feb 11, 2009
1 parent 3d20c63 commit fa3a0c9
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions sha1_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,7 @@ void free_pack_by_name(const char *pack_name)
while (*pp) {
p = *pp;
if (strcmp(pack_name, p->pack_name) == 0) {
clear_delta_base_cache();
close_pack_windows(p);
if (p->pack_fd != -1)
close(p->pack_fd);
Expand Down

0 comments on commit fa3a0c9

Please sign in to comment.