diff mbox series

[04/24] pack-bitmap: drop unused `max_bitmaps` parameter

Message ID c6a08dae037351f0a5ba8f1044837c894c471b4f.1710972293.git.me@ttaylorr.com (mailing list archive)
State New, archived
Headers show
Series pack-bitmap: pseudo-merge reachability bitmaps | expand

Commit Message

Taylor Blau March 20, 2024, 10:05 p.m. UTC
The `max_bitmaps` parameter in `bitmap_writer_select_commits()` was
introduced back in 7cc8f97108 (pack-objects: implement bitmap writing,
2013-12-21), making it original to the bitmap implementation in Git
itself.

When that patch was merged via 0f9e62e084 (Merge branch
'jk/pack-bitmap', 2014-02-27), its sole caller in builtin/pack-objects.c
passed a value of "-1" for `max_bitmaps`, indicating no limit.

Since then, the only other caller (in midx.c, added via c528e17966
(pack-bitmap: write multi-pack bitmaps, 2021-08-31)) also uses a value
of "-1" for `max_bitmaps`.

Since no callers have needed a finite limit for the `max_bitmaps`
parameter in the nearly decade that has passed since 0f9e62e084, let's
remove the parameter and any dead pieces of code connected to it.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
---
 builtin/pack-objects.c | 2 +-
 midx.c                 | 2 +-
 pack-bitmap-write.c    | 8 +-------
 pack-bitmap.h          | 2 +-
 4 files changed, 4 insertions(+), 10 deletions(-)

Comments

Jeff King April 10, 2024, 6:06 p.m. UTC | #1
On Wed, Mar 20, 2024 at 06:05:11PM -0400, Taylor Blau wrote:

> The `max_bitmaps` parameter in `bitmap_writer_select_commits()` was
> introduced back in 7cc8f97108 (pack-objects: implement bitmap writing,
> 2013-12-21), making it original to the bitmap implementation in Git
> itself.
> 
> When that patch was merged via 0f9e62e084 (Merge branch
> 'jk/pack-bitmap', 2014-02-27), its sole caller in builtin/pack-objects.c
> passed a value of "-1" for `max_bitmaps`, indicating no limit.
> 
> Since then, the only other caller (in midx.c, added via c528e17966
> (pack-bitmap: write multi-pack bitmaps, 2021-08-31)) also uses a value
> of "-1" for `max_bitmaps`.
> 
> Since no callers have needed a finite limit for the `max_bitmaps`
> parameter in the nearly decade that has passed since 0f9e62e084, let's
> remove the parameter and any dead pieces of code connected to it.

Great, I'm happy to see dead code being cleaned up. And thanks (as
always) for digging into the history to explain how we got here.

-Peff
diff mbox series

Patch

diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 329aeac8043..41281cae91f 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -1359,7 +1359,7 @@  static void write_pack_file(void)
 				stop_progress(&progress_state);
 
 				bitmap_writer_show_progress(progress);
-				bitmap_writer_select_commits(indexed_commits, indexed_commits_nr, -1);
+				bitmap_writer_select_commits(indexed_commits, indexed_commits_nr);
 				if (bitmap_writer_build(&to_pack) < 0)
 					die(_("failed to write bitmap index"));
 				bitmap_writer_finish(written_list, nr_written,
diff --git a/midx.c b/midx.c
index 85e1c2cd128..366bfbe18c8 100644
--- a/midx.c
+++ b/midx.c
@@ -1330,7 +1330,7 @@  static int write_midx_bitmap(const char *midx_name,
 	for (i = 0; i < pdata->nr_objects; i++)
 		index[pack_order[i]] = &pdata->objects[i].idx;
 
-	bitmap_writer_select_commits(commits, commits_nr, -1);
+	bitmap_writer_select_commits(commits, commits_nr);
 	ret = bitmap_writer_build(pdata);
 	if (ret < 0)
 		goto cleanup;
diff --git a/pack-bitmap-write.c b/pack-bitmap-write.c
index 990a9498d73..3dc2408eca7 100644
--- a/pack-bitmap-write.c
+++ b/pack-bitmap-write.c
@@ -591,8 +591,7 @@  static int date_compare(const void *_a, const void *_b)
 }
 
 void bitmap_writer_select_commits(struct commit **indexed_commits,
-				  unsigned int indexed_commits_nr,
-				  int max_bitmaps)
+				  unsigned int indexed_commits_nr)
 {
 	unsigned int i = 0, j, next;
 
@@ -615,11 +614,6 @@  void bitmap_writer_select_commits(struct commit **indexed_commits,
 		if (i + next >= indexed_commits_nr)
 			break;
 
-		if (max_bitmaps > 0 && writer.selected_nr >= max_bitmaps) {
-			writer.selected_nr = max_bitmaps;
-			break;
-		}
-
 		if (next == 0) {
 			chosen = indexed_commits[i];
 		} else {
diff --git a/pack-bitmap.h b/pack-bitmap.h
index c7dea13217a..3f96608d5c1 100644
--- a/pack-bitmap.h
+++ b/pack-bitmap.h
@@ -110,7 +110,7 @@  int rebuild_bitmap(const uint32_t *reposition,
 struct ewah_bitmap *bitmap_for_commit(struct bitmap_index *bitmap_git,
 				      struct commit *commit);
 void bitmap_writer_select_commits(struct commit **indexed_commits,
-		unsigned int indexed_commits_nr, int max_bitmaps);
+				  unsigned int indexed_commits_nr);
 int bitmap_writer_build(struct packing_data *to_pack);
 void bitmap_writer_finish(struct pack_idx_entry **index,
 			  uint32_t index_nr,