diff mbox series

[08/24] pack-bitmap: implement `bitmap_writer_has_bitmapped_object_id()`

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

Commit Message

Taylor Blau March 20, 2024, 10:05 p.m. UTC
Prepare to implement pseudo-merge bitmap selection by implementing a
necessary new function, `bitmap_writer_has_bitmapped_object_id()`.

This function returns whether or not the bitmap_writer selected the
given object ID for bitmapping. This will allow the pseudo-merge
machinery to reject candidates for pseudo-merges if they have already
been selected as an ordinary bitmap tip.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
---
 pack-bitmap-write.c | 5 +++++
 pack-bitmap.h       | 2 ++
 2 files changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/pack-bitmap-write.c b/pack-bitmap-write.c
index b1e8a0ad66d..cd528f89a76 100644
--- a/pack-bitmap-write.c
+++ b/pack-bitmap-write.c
@@ -123,6 +123,11 @@  void bitmap_writer_build_type_index(struct packing_data *to_pack,
 	}
 }
 
+int bitmap_writer_has_bitmapped_object_id(const struct object_id *oid)
+{
+	return kh_get_oid_map(writer.bitmaps, *oid) != kh_end(writer.bitmaps);
+}
+
 /**
  * Compute the actual bitmaps
  */
diff --git a/pack-bitmap.h b/pack-bitmap.h
index ca9acd2f735..995d664cc89 100644
--- a/pack-bitmap.h
+++ b/pack-bitmap.h
@@ -98,6 +98,8 @@  int bitmap_has_oid_in_uninteresting(struct bitmap_index *, const struct object_i
 
 off_t get_disk_usage_from_bitmap(struct bitmap_index *, struct rev_info *);
 
+int bitmap_writer_has_bitmapped_object_id(const struct object_id *oid);
+
 void bitmap_writer_init(struct repository *r);
 void bitmap_writer_show_progress(int show);
 void bitmap_writer_set_checksum(const unsigned char *sha1);