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

[PATCH 2/2] pack-bitmap: drop bitmap_index argument from try_partial_reuse()

From
Jeff King <peff@peff.net>
Date
Sep 9, 2021, 19:57 UTC
Message-ID
<YTpnIQSiYfSYlexy@coredump.intra.peff.net>
In-Reply-To
<YTpms9UnVsx+uu/2@coredump.intra.peff.net>

Starting in commit 0f533c7284 (pack-bitmap: read multi-pack bitmaps, 2021-08-31), we no longer look at the "struct bitmap_index" passed to try_partial_reuse(). This is because we only handle verbatim reuse from a single pack: either the pack whose bitmap we're looking at, or the "preferred" pack of a midx bitmap. And thus the primary item we look at is the "pack" parameter added by that same commit, and not the bitmap_git->pack parameter (which would be NULL for a midx bitmap). It's our caller, reuse_partial_packfile_from_bitmap(), which decides which pack to use and passes it in to us.

Drop the unused parameter to prevent confusion.
Signed-off-by: Jeff King <peff@peff.net>
---
 pack-bitmap.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/pack-bitmap.c b/pack-bitmap.c
index f2a7994a9c..8504110a4d 100644
--- a/pack-bitmap.c
+++ b/pack-bitmap.c
@@ -1328,8 +1328,7 @@ struct bitmap_index *prepare_bitmap_walk(struct rev_info *revs,
  * -1 means "stop trying further objects"; 0 means we may or may not have
  * reused, but you can keep feeding bits.
  */
-static int try_partial_reuse(struct bitmap_index *bitmap_git,
-			     struct packed_git *pack,
+static int try_partial_reuse(struct packed_git *pack,
 			     size_t pos,
 			     struct bitmap *reuse,
 			     struct pack_window **w_curs)
@@ -1476,7 +1475,7 @@ int reuse_partial_packfile_from_bitmap(struct bitmap_index *bitmap_git,
 				break;
 
 			offset += ewah_bit_ctz64(word >> offset);
-			if (try_partial_reuse(bitmap_git, pack, pos + offset,
+			if (try_partial_reuse(pack, pos + offset,
 					      reuse, &w_curs) < 0) {
 				/*
 				 * try_partial_reuse indicated we couldn't reuse
-- 
2.33.0.621.ga797e945d8
Previous: Jeff KingNext: Taylor Blau
Message 3 of 4 in “-Wunused-parameter clenaups on tb/multi-pack-bitmaps”
  1. 0/2 -Wunused-parameter clenaups on tb/multi-pack-bitmapsJeff King, Sep 9, 2021
  2. 1/2 pack-bitmap: drop repository argument from prepare_midx_bitmap_git()Jeff King, Sep 9, 2021
  3. 2/2 pack-bitmap: drop bitmap_index argument from try_partial_reuse()Jeff King, Sep 9, 2021
  4. Taylor BlauSep 9, 2021

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.