X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=sha1_file.c;h=a07aa4e5c491d16f65bc109673e806e24efb2274;hb=39d8e271f42e976a61f08a4f7bc2047a682ac532;hp=8868b800cbb9259f97b8acac3c8701153118b657;hpb=bd9efbf35424c9436f62768e47f5819c9b5bcf9e;p=git.git diff --git a/sha1_file.c b/sha1_file.c index 8868b800c..a07aa4e5c 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -689,6 +689,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); @@ -800,7 +801,7 @@ unsigned char* use_pack(struct packed_git *p, if (p->pack_fd == -1 && open_packed_git(p)) die("packfile %s cannot be accessed", p->pack_name); - /* Since packfiles end in a hash of their content and its + /* Since packfiles end in a hash of their content and it's * pointless to ask for an offset into the middle of that * hash, and the in_window function above wouldn't match * don't allow an offset too close to the end of the file. @@ -1663,6 +1664,13 @@ static inline void release_delta_base_cache(struct delta_base_cache_entry *ent) } } +void clear_delta_base_cache(void) +{ + unsigned long p; + for (p = 0; p < MAX_DELTA_CACHE; p++) + release_delta_base_cache(&delta_base_cache[p]); +} + static void add_delta_base_cache(struct packed_git *p, off_t base_offset, void *base, unsigned long base_size, enum object_type type) { @@ -2293,7 +2301,7 @@ static void close_sha1_file(int fd) fsync_or_die(fd, "sha1 file"); fchmod(fd, 0444); if (close(fd) != 0) - die("unable to write sha1 file"); + die("error when closing sha1 file (%s)", strerror(errno)); } /* Size of directory component, including the ending '/' */