{"thread":{"id":"56474","subject":"[PATCH 0/2] -Wunused-parameter clenaups on tb/multi-pack-bitmaps","startedAt":"2021-09-09T19:55:35Z","lastAt":"2021-09-09T20:46:34Z","messageCount":4,"participants":["Jeff King","Taylor Blau"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"435323","messageId":"YTpms9UnVsx+uu/2@coredump.intra.peff.net","threadId":"56474","inReplyTo":null,"subject":"[PATCH 0/2] -Wunused-parameter clenaups on tb/multi-pack-bitmaps","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2021-09-09T19:55:31Z","receivedAt":"2021-09-09T19:55:35Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Now that tb/multi-pack-bitmaps is in \"next\", my local -Wunused-parameter\ntopic noticed a few possible cleanups. Neither is a big deal, and I can\ndefinitely hold them for a larger cleanup. But I thought it might be\nworth doing them while they're fresh in our minds.\n\n  [1/2]: pack-bitmap: drop repository argument from prepare_midx_bitmap_git()\n  [2/2]: pack-bitmap: drop bitmap_index argument from try_partial_reuse()\n\n midx.c        | 2 +-\n pack-bitmap.c | 8 +++-----\n pack-bitmap.h | 3 +--\n 3 files changed, 5 insertions(+), 8 deletions(-)\n\n-Peff\n"},{"id":"435325","messageId":"YTpnCsqXdzeFp8Uz@coredump.intra.peff.net","threadId":"56474","inReplyTo":"YTpms9UnVsx+uu/2@coredump.intra.peff.net","subject":"[PATCH 1/2] pack-bitmap: drop repository argument from prepare_midx_bitmap_git()","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2021-09-09T19:56:58Z","receivedAt":"2021-09-09T19:57:01Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"We never look at the repository argument which is passed. This makes\nsense, since the multi_pack_index struct already tells us everything we\nneed to access the files in its associated object directory.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n midx.c        | 2 +-\n pack-bitmap.c | 3 +--\n pack-bitmap.h | 3 +--\n 3 files changed, 3 insertions(+), 5 deletions(-)\n\ndiff --git a/midx.c b/midx.c\nindex ccdc3e5702..864034a6ad 100644\n--- a/midx.c\n+++ b/midx.c\n@@ -1144,7 +1144,7 @@ static int write_midx_internal(const char *object_dir,\n \t\tint bitmap_exists;\n \t\tint want_bitmap = flags & MIDX_WRITE_BITMAP;\n \n-\t\tbitmap_git = prepare_midx_bitmap_git(the_repository, ctx.m);\n+\t\tbitmap_git = prepare_midx_bitmap_git(ctx.m);\n \t\tbitmap_exists = bitmap_git && bitmap_is_midx(bitmap_git);\n \t\tfree_bitmap_index(bitmap_git);\n \ndiff --git a/pack-bitmap.c b/pack-bitmap.c\nindex fa69ed7a6d..f2a7994a9c 100644\n--- a/pack-bitmap.c\n+++ b/pack-bitmap.c\n@@ -517,8 +517,7 @@ struct bitmap_index *prepare_bitmap_git(struct repository *r)\n \treturn NULL;\n }\n \n-struct bitmap_index *prepare_midx_bitmap_git(struct repository *r,\n-\t\t\t\t\t     struct multi_pack_index *midx)\n+struct bitmap_index *prepare_midx_bitmap_git(struct multi_pack_index *midx)\n {\n \tstruct bitmap_index *bitmap_git = xcalloc(1, sizeof(*bitmap_git));\n \ndiff --git a/pack-bitmap.h b/pack-bitmap.h\nindex 81664f933f..469090bad2 100644\n--- a/pack-bitmap.h\n+++ b/pack-bitmap.h\n@@ -44,8 +44,7 @@ typedef int (*show_reachable_fn)(\n struct bitmap_index;\n \n struct bitmap_index *prepare_bitmap_git(struct repository *r);\n-struct bitmap_index *prepare_midx_bitmap_git(struct repository *r,\n-\t\t\t\t\t     struct multi_pack_index *midx);\n+struct bitmap_index *prepare_midx_bitmap_git(struct multi_pack_index *midx);\n void count_bitmap_commit_list(struct bitmap_index *, uint32_t *commits,\n \t\t\t      uint32_t *trees, uint32_t *blobs, uint32_t *tags);\n void traverse_bitmap_commit_list(struct bitmap_index *,\n-- \n2.33.0.621.ga797e945d8\n\n"},{"id":"435326","messageId":"YTpnIQSiYfSYlexy@coredump.intra.peff.net","threadId":"56474","inReplyTo":"YTpms9UnVsx+uu/2@coredump.intra.peff.net","subject":"[PATCH 2/2] pack-bitmap: drop bitmap_index argument from try_partial_reuse()","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2021-09-09T19:57:21Z","receivedAt":"2021-09-09T19:57:23Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Starting in commit 0f533c7284 (pack-bitmap: read multi-pack bitmaps,\n2021-08-31), we no longer look at the \"struct bitmap_index\" passed to\ntry_partial_reuse(). This is because we only handle verbatim reuse from\na single pack: either the pack whose bitmap we're looking at, or the\n\"preferred\" pack of a midx bitmap. And thus the primary item we look at\nis the \"pack\" parameter added by that same commit, and not the\nbitmap_git->pack parameter (which would be NULL for a midx bitmap). It's\nour caller, reuse_partial_packfile_from_bitmap(), which decides which\npack to use and passes it in to us.\n\nDrop the unused parameter to prevent confusion.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n pack-bitmap.c | 5 ++---\n 1 file changed, 2 insertions(+), 3 deletions(-)\n\ndiff --git a/pack-bitmap.c b/pack-bitmap.c\nindex f2a7994a9c..8504110a4d 100644\n--- a/pack-bitmap.c\n+++ b/pack-bitmap.c\n@@ -1328,8 +1328,7 @@ struct bitmap_index *prepare_bitmap_walk(struct rev_info *revs,\n  * -1 means \"stop trying further objects\"; 0 means we may or may not have\n  * reused, but you can keep feeding bits.\n  */\n-static int try_partial_reuse(struct bitmap_index *bitmap_git,\n-\t\t\t     struct packed_git *pack,\n+static int try_partial_reuse(struct packed_git *pack,\n \t\t\t     size_t pos,\n \t\t\t     struct bitmap *reuse,\n \t\t\t     struct pack_window **w_curs)\n@@ -1476,7 +1475,7 @@ int reuse_partial_packfile_from_bitmap(struct bitmap_index *bitmap_git,\n \t\t\t\tbreak;\n \n \t\t\toffset += ewah_bit_ctz64(word >> offset);\n-\t\t\tif (try_partial_reuse(bitmap_git, pack, pos + offset,\n+\t\t\tif (try_partial_reuse(pack, pos + offset,\n \t\t\t\t\t      reuse, &w_curs) < 0) {\n \t\t\t\t/*\n \t\t\t\t * try_partial_reuse indicated we couldn't reuse\n-- \n2.33.0.621.ga797e945d8\n"},{"id":"435332","messageId":"YTpyp8ul6ipgDAhY@nand.local","threadId":"56474","inReplyTo":"YTpms9UnVsx+uu/2@coredump.intra.peff.net","subject":"Re: [PATCH 0/2] -Wunused-parameter clenaups on tb/multi-pack-bitmaps","fromName":"Taylor Blau","fromEmail":"me@ttaylorr.com","sentAt":"2021-09-09T20:46:31Z","receivedAt":"2021-09-09T20:46:34Z","isPatch":true,"sender":{"key":"me@ttaylorr.com","avatar":"https://avatars.githubusercontent.com/u/301000140?v=4"},"body":"On Thu, Sep 09, 2021 at 03:55:31PM -0400, Jeff King wrote:\n> Now that tb/multi-pack-bitmaps is in \"next\", my local -Wunused-parameter\n> topic noticed a few possible cleanups. Neither is a big deal, and I can\n> definitely hold them for a larger cleanup. But I thought it might be\n> worth doing them while they're fresh in our minds.\n\nThanks, I'd be happy to see this picked up while the topic is still in\nnext. Both of the spots you touched looked good to me (and don't\nsuddenly become necessary in any of the later series that I'm sitting on).\n\n    Reviewed-by: Taylor Blau <me@ttaylorr.com>\n\nThanks,\nTaylor\n"}]}