git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/2] packfile: move around `close_pack()`

From
Patrick Steinhardt <ps@pks.im>
Date
Oct 2, 2026, 07:34 UTC
Message-ID
<20261002-pks-packfile-stale-delta-base-cache-v1-1-7592a3e31ae0@pks.im>
In-Reply-To
<20261002-pks-packfile-stale-delta-base-cache-v1-0-7592a3e31ae0@pks.im>

In the next commit we'll want to access the delta base cache in `close_pack()`. Move the function after the declaration of the cache to prepare for this.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 packfile.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/packfile.c b/packfile.c
index 4fa5fd67c8..af1b837974 100644
--- a/packfile.c
+++ b/packfile.c
@@ -355,16 +355,6 @@ static void close_pack_mtimes(struct packed_git *p)
 	p->mtimes_map = NULL;
 }
 
-void close_pack(struct packed_git *p)
-{
-	close_pack_windows(p);
-	close_pack_fd(p);
-	close_pack_index(p);
-	close_pack_revindex(p);
-	close_pack_mtimes(p);
-	oidset_clear(&p->bad_objects);
-}
-
 void unlink_pack_path(const char *pack_name, int force_delete)
 {
 	static const char *exts[] = {".idx", ".pack", ".rev", ".keep", ".bitmap", ".promisor", ".mtimes"};
@@ -1263,6 +1253,16 @@ void clear_delta_base_cache(void)
 	}
 }
 
+void close_pack(struct packed_git *p)
+{
+	close_pack_windows(p);
+	close_pack_fd(p);
+	close_pack_index(p);
+	close_pack_revindex(p);
+	close_pack_mtimes(p);
+	oidset_clear(&p->bad_objects);
+}
+
 static void add_delta_base_cache(struct packed_git *p, off_t base_offset,
 				 void *base, size_t base_size,
 				 size_t delta_base_cache_limit,
-- 
2.56.0.353.g0856645cf6.dirty
Previous: Patrick SteinhardtNext: Mark C. Chu-Carroll
Message 2 of 18 in “packfile: fix corruption due to stale delta base cache entries”
  1. 0/2 packfile: fix corruption due to stale delta base cache entriesPatrick Steinhardt, Oct 2, 2026
  2. 1/2 packfile: move around `close_pack()`Patrick Steinhardt, Oct 2, 2026
  3. Mark C. Chu-CarrollOct 2, 2026
  4. Patrick SteinhardtOct 2, 2026
  5. 2/2 packfile: fix corruption due to stale delta base cache entriesPatrick Steinhardt, Oct 2, 2026
  6. Guillaume ChauvelOct 2, 2026
  7. Patrick SteinhardtOct 2, 2026
  8. Philippe BlainOct 2, 2026
  9. Patrick SteinhardtOct 2, 2026
  10. Jeff KingOct 2, 2026
  11. Patrick SteinhardtOct 5, 2026
  12. Jeff KingOct 7, 2026
  13. Junio C HamanoOct 7, 2026
  14. 0/2 packfile: fix corruption due to stale delta base cache entriesPatrick Steinhardt, Oct 6, 2026
  15. 1/2 packfile: move around `close_pack()`Patrick Steinhardt, Oct 6, 2026
  16. 2/2 packfile: fix corruption due to stale delta base cache entriesPatrick Steinhardt, Oct 6, 2026
  17. Junio C HamanoOct 6, 2026
  18. Patrick SteinhardtOct 7, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.