summaryrefslogtreecommitdiffstats
path: root/pack-bitmap-write.c
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2024-05-23 23:26:42 +0200
committerJunio C Hamano <gitster@pobox.com>2024-05-24 20:40:42 +0200
commitfaf558b23ef55b18f395d1f7a7c2714ccc1320e2 (patch)
tree4b18d29919b4f980c71cd3f71a7b6efef669f8f6 /pack-bitmap-write.c
parentconfig: introduce `git_config_double()` (diff)
downloadgit-faf558b23ef55b18f395d1f7a7c2714ccc1320e2.tar.xz
git-faf558b23ef55b18f395d1f7a7c2714ccc1320e2.zip
pseudo-merge: implement support for selecting pseudo-merge commits
Teach the new pseudo-merge machinery how to select non-bitmapped commits for inclusion in different pseudo-merge group(s) based on a handful of criteria. Note that the selected pseudo-merge commits aren't actually used or written anywhere yet. This will be done in the following commit. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pack-bitmap-write.c')
-rw-r--r--pack-bitmap-write.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/pack-bitmap-write.c b/pack-bitmap-write.c
index bc19b33ad1..d5884ea5e9 100644
--- a/pack-bitmap-write.c
+++ b/pack-bitmap-write.c
@@ -17,6 +17,7 @@
#include "trace2.h"
#include "tree.h"
#include "tree-walk.h"
+#include "pseudo-merge.h"
struct bitmapped_commit {
struct commit *commit;
@@ -39,11 +40,25 @@ void bitmap_writer_init(struct bitmap_writer *writer, struct repository *r)
if (writer->bitmaps)
BUG("bitmap writer already initialized");
writer->bitmaps = kh_init_oid_map();
+ writer->pseudo_merge_commits = kh_init_oid_map();
+
+ string_list_init_dup(&writer->pseudo_merge_groups);
+
+ load_pseudo_merges_from_config(&writer->pseudo_merge_groups);
+}
+
+static void free_pseudo_merge_commit_idx(struct pseudo_merge_commit_idx *idx)
+{
+ if (!idx)
+ return;
+ free(idx->pseudo_merge);
+ free(idx);
}
void bitmap_writer_free(struct bitmap_writer *writer)
{
uint32_t i;
+ struct pseudo_merge_commit_idx *idx;
if (!writer)
return;
@@ -55,6 +70,10 @@ void bitmap_writer_free(struct bitmap_writer *writer)
kh_destroy_oid_map(writer->bitmaps);
+ kh_foreach_value(writer->pseudo_merge_commits, idx,
+ free_pseudo_merge_commit_idx(idx));
+ kh_destroy_oid_map(writer->pseudo_merge_commits);
+
for (i = 0; i < writer->selected_nr; i++) {
struct bitmapped_commit *bc = &writer->selected[i];
if (bc->write_as != bc->bitmap)
@@ -703,6 +722,8 @@ void bitmap_writer_select_commits(struct bitmap_writer *writer,
}
stop_progress(&writer->progress);
+
+ select_pseudo_merges(writer, indexed_commits, indexed_commits_nr);
}