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

[PATCH 3/5] pack-bitmap: drop unused parameters from select_pseudo_merges()

From
Jeff King <peff@peff.net>
Date
Aug 17, 2024, 07:29 UTC
Message-ID
<20240817072937.GC1535915@coredump.intra.peff.net>
In-Reply-To
<20240817072621.GA1535666@coredump.intra.peff.net>

We take the array of indexed_commits (and its length), but there's no need. The selection is based on ref reachability, not the linearized set of commits we're packing.

Signed-off-by: Jeff King <peff@peff.net>
---
A careful reader may wonder whether we ought to be using the set of
commits to limit what we're willing to select (since we can't make a
bitmap for a commit that isn't in our index).

And this is indeed a problem, but the solution doesn't involve using indexed_commits. It should be fixed in this series:

  https://lore.kernel.org/git/c9a64b1d2a9d6b3fe1f5fb0a7303e043114fcd8f.1723743050.git.me@ttaylorr.com/
 pack-bitmap-write.c | 2 +-
 pseudo-merge.c      | 3 +--
 pseudo-merge.h      | 3 +--
 3 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/pack-bitmap-write.c b/pack-bitmap-write.c
index 7787600234..9b9ca1cc36 100644
--- a/pack-bitmap-write.c
+++ b/pack-bitmap-write.c
@@ -737,7 +737,7 @@ void bitmap_writer_select_commits(struct bitmap_writer *writer,
 
 	stop_progress(&writer->progress);
 
-	select_pseudo_merges(writer, indexed_commits, indexed_commits_nr);
+	select_pseudo_merges(writer);
 }
 
 
diff --git a/pseudo-merge.c b/pseudo-merge.c
index 1d7f5381a4..c952a7cba9 100644
--- a/pseudo-merge.c
+++ b/pseudo-merge.c
@@ -425,8 +425,7 @@ static void sort_pseudo_merge_matches(struct pseudo_merge_matches *matches)
 	QSORT(matches->unstable, matches->unstable_nr, commit_date_cmp);
 }
 
-void select_pseudo_merges(struct bitmap_writer *writer,
-			  struct commit **commits, size_t commits_nr)
+void select_pseudo_merges(struct bitmap_writer *writer)
 {
 	struct progress *progress = NULL;
 	uint32_t i;
diff --git a/pseudo-merge.h b/pseudo-merge.h
index 3aecba772b..4b5febaa63 100644
--- a/pseudo-merge.h
+++ b/pseudo-merge.h
@@ -95,8 +95,7 @@ struct pseudo_merge_commit_idx {
  *
  * Optionally shows a progress meter.
  */
-void select_pseudo_merges(struct bitmap_writer *writer,
-			  struct commit **commits, size_t commits_nr);
+void select_pseudo_merges(struct bitmap_writer *writer);
 
 /*
  * Represents a serialized view of a file containing pseudo-merge(s)
-- 
2.46.0.585.gd6679c16d8
Previous: Eric SunshineNext: Jeff King
Message 5 of 7 in “dropping some more unused parameters”
  1. 0/5 dropping some more unused parametersJeff King, Aug 17, 2024
  2. 1/5 refs: drop some unused parameters from create_symref_lock()Jeff King, Aug 17, 2024
  3. 2/5 pack-bitmap: load writer config from repository parameterJeff King, Aug 17, 2024
  4. Eric SunshineAug 17, 2024
  5. 3/5 pack-bitmap: drop unused parameters from select_pseudo_merges()Jeff King, Aug 17, 2024
  6. 4/5 ref-filter: drop unused parameters from email_atom_option_parser()Jeff King, Aug 17, 2024
  7. 5/5 diff-lib: drop unused index argument from get_stat_data()Jeff King, Aug 17, 2024

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.