aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2025-10-15 18:29:02 -0400
committerJunio C Hamano <gitster@pobox.com>2025-10-16 10:08:56 -0700
commit42088e3d4ae5c5bc77a49fcbba79832d10d03499 (patch)
tree1aae317f488538719aa8c5dba3a2979b7fb10519
parent2fee63a71ae8113fd91d8e5924ae4a5619ad0cd3 (diff)
downloadgit-42088e3d4ae5c5bc77a49fcbba79832d10d03499.tar.xz
builtin/repack.c: reorder `remove_redundant_bitmaps()`
The next commit will inline the call to `remove_redundant_bitmaps()` into `write_midx_included_packs()`. Reorder these two functions to avoid a forward declaration to `remove_redundant_bitmaps()`. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin/repack.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/builtin/repack.c b/builtin/repack.c
index a57a14ef60..865e0af039 100644
--- a/builtin/repack.c
+++ b/builtin/repack.c
@@ -296,6 +296,35 @@ static void midx_included_packs(struct string_list *include,
strbuf_release(&buf);
}
+static void remove_redundant_bitmaps(struct string_list *include,
+ const char *packdir)
+{
+ struct strbuf path = STRBUF_INIT;
+ struct string_list_item *item;
+ size_t packdir_len;
+
+ strbuf_addstr(&path, packdir);
+ strbuf_addch(&path, '/');
+ packdir_len = path.len;
+
+ /*
+ * Remove any pack bitmaps corresponding to packs which are now
+ * included in the MIDX.
+ */
+ for_each_string_list_item(item, include) {
+ strbuf_addstr(&path, item->string);
+ strbuf_strip_suffix(&path, ".idx");
+ strbuf_addstr(&path, ".bitmap");
+
+ if (unlink(path.buf) && errno != ENOENT)
+ warning_errno(_("could not remove stale bitmap: %s"),
+ path.buf);
+
+ strbuf_setlen(&path, packdir_len);
+ }
+ strbuf_release(&path);
+}
+
static int write_midx_included_packs(struct repack_write_midx_opts *opts)
{
struct child_process cmd = CHILD_PROCESS_INIT;
@@ -373,35 +402,6 @@ static int write_midx_included_packs(struct repack_write_midx_opts *opts)
return finish_command(&cmd);
}
-static void remove_redundant_bitmaps(struct string_list *include,
- const char *packdir)
-{
- struct strbuf path = STRBUF_INIT;
- struct string_list_item *item;
- size_t packdir_len;
-
- strbuf_addstr(&path, packdir);
- strbuf_addch(&path, '/');
- packdir_len = path.len;
-
- /*
- * Remove any pack bitmaps corresponding to packs which are now
- * included in the MIDX.
- */
- for_each_string_list_item(item, include) {
- strbuf_addstr(&path, item->string);
- strbuf_strip_suffix(&path, ".idx");
- strbuf_addstr(&path, ".bitmap");
-
- if (unlink(path.buf) && errno != ENOENT)
- warning_errno(_("could not remove stale bitmap: %s"),
- path.buf);
-
- strbuf_setlen(&path, packdir_len);
- }
- strbuf_release(&path);
-}
-
static int finish_pack_objects_cmd(const struct git_hash_algo *algop,
struct child_process *cmd,
struct string_list *names,