]> git.ipfire.org Git - thirdparty/git.git/blobdiff - sha1_file.c
Fix random fast-import errors when compiled with NO_MMAP
[thirdparty/git.git] / sha1_file.c
index 6583797ce5853bc17ce95bf4cc86af6ee0f660b1..66a4e00fa83fd9fc853a1ba8a308b05cdc030967 100644 (file)
@@ -611,6 +611,22 @@ void release_pack_memory(size_t need, int fd)
                ; /* nothing */
 }
 
+void close_pack_windows(struct packed_git *p)
+{
+       while (p->windows) {
+               struct pack_window *w = p->windows;
+
+               if (w->inuse_cnt)
+                       die("pack '%s' still has open windows to it",
+                           p->pack_name);
+               munmap(w->base, w->len);
+               pack_mapped -= w->len;
+               pack_open_windows--;
+               p->windows = w->next;
+               free(w);
+       }
+}
+
 void unuse_pack(struct pack_window **w_cursor)
 {
        struct pack_window *w = *w_cursor;