diff options
| author | Junio C Hamano <gitster@pobox.com> | 2024-06-07 10:57:23 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-06-07 10:57:23 -0700 |
| commit | 1b76f065085811104b5f4adff001956d7e5c5d1c (patch) | |
| tree | f331e43e85de3767abb7f8d353fa174db344f1f3 /midx.c | |
| parent | cd77e87115eab5e80e6b161e7b84a79ba1a12cdc (diff) | |
| parent | 4cac79a50e242c8864e2c0f2fbf40e2d22b5fee6 (diff) | |
| download | git-1b76f065085811104b5f4adff001956d7e5c5d1c.tar.gz | |
Merge branch 'tb/midx-write-cleanup'
Code clean-up around writing the .midx files.
* tb/midx-write-cleanup:
pack-bitmap.c: reimplement `midx_bitmap_filename()` with helper
midx: replace `get_midx_rev_filename()` with a generic helper
midx-write.c: support reading an existing MIDX with `packs_to_include`
midx-write.c: extract `fill_packs_from_midx()`
midx-write.c: extract `should_include_pack()`
midx-write.c: pass `start_pack` to `compute_sorted_entries()`
midx-write.c: reduce argument count for `get_sorted_entries()`
midx-write.c: tolerate `--preferred-pack` without bitmaps
Diffstat (limited to 'midx.c')
| -rw-r--r-- | midx.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -25,13 +25,15 @@ const unsigned char *get_midx_checksum(struct multi_pack_index *m) void get_midx_filename(struct strbuf *out, const char *object_dir) { - strbuf_addf(out, "%s/pack/multi-pack-index", object_dir); + get_midx_filename_ext(out, object_dir, NULL, NULL); } -void get_midx_rev_filename(struct strbuf *out, struct multi_pack_index *m) +void get_midx_filename_ext(struct strbuf *out, const char *object_dir, + const unsigned char *hash, const char *ext) { - get_midx_filename(out, m->object_dir); - strbuf_addf(out, "-%s.rev", hash_to_hex(get_midx_checksum(m))); + strbuf_addf(out, "%s/pack/multi-pack-index", object_dir); + if (ext) + strbuf_addf(out, "-%s.%s", hash_to_hex(hash), ext); } static int midx_read_oid_fanout(const unsigned char *chunk_start, |
