diff options
| author | Junio C Hamano <gitster@pobox.com> | 2025-02-03 10:23:34 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-02-03 10:23:34 -0800 |
| commit | b83a2f9006cdf5293370b1254f4f4cb2770c1b9f (patch) | |
| tree | 5f09867e19b13f6f513b8881fdf5d03f906079b5 /builtin | |
| parent | f49905d47d42cf6ea4c34b5a8301e84149e7aeba (diff) | |
| parent | 8705c9bd139028aae148251420da27c9bf1c4745 (diff) | |
| download | git-b83a2f9006cdf5293370b1254f4f4cb2770c1b9f.tar.xz | |
Merge branch 'kn/pack-write-with-reduced-globals'
Code clean-up.
* kn/pack-write-with-reduced-globals:
pack-write: pass hash_algo to internal functions
pack-write: pass hash_algo to `write_rev_file()`
pack-write: pass hash_algo to `write_idx_file()`
pack-write: pass repository to `index_pack_lockfile()`
pack-write: pass hash_algo to `fixup_pack_header_footer()`
Diffstat (limited to 'builtin')
| -rw-r--r-- | builtin/fast-import.c | 11 | ||||
| -rw-r--r-- | builtin/index-pack.c | 11 | ||||
| -rw-r--r-- | builtin/pack-objects.c | 12 | ||||
| -rw-r--r-- | builtin/receive-pack.c | 2 |
4 files changed, 20 insertions, 16 deletions
diff --git a/builtin/fast-import.c b/builtin/fast-import.c index ccdada1810..a6a84058cd 100644 --- a/builtin/fast-import.c +++ b/builtin/fast-import.c @@ -798,8 +798,8 @@ static const char *create_index(void) if (c != last) die("internal consistency error creating the index"); - tmpfile = write_idx_file(NULL, idx, object_count, &pack_idx_opts, - pack_data->hash); + tmpfile = write_idx_file(the_hash_algo, NULL, idx, object_count, + &pack_idx_opts, pack_data->hash); free(idx); return tmpfile; } @@ -878,9 +878,10 @@ static void end_packfile(void) close_pack_windows(pack_data); finalize_hashfile(pack_file, cur_pack_oid.hash, FSYNC_COMPONENT_PACK, 0); - fixup_pack_header_footer(pack_data->pack_fd, pack_data->hash, - pack_data->pack_name, object_count, - cur_pack_oid.hash, pack_size); + fixup_pack_header_footer(the_hash_algo, pack_data->pack_fd, + pack_data->hash, pack_data->pack_name, + object_count, cur_pack_oid.hash, + pack_size); if (object_count <= unpack_limit) { if (!loosen_small_pack(pack_data)) { diff --git a/builtin/index-pack.c b/builtin/index-pack.c index 6ffbb7ce35..c2a1750631 100644 --- a/builtin/index-pack.c +++ b/builtin/index-pack.c @@ -1392,7 +1392,7 @@ static void conclude_pack(int fix_thin_pack, const char *curr_pack, unsigned cha strbuf_release(&msg); finalize_hashfile(f, tail_hash, FSYNC_COMPONENT_PACK, 0); hashcpy(read_hash, pack_hash, the_repository->hash_algo); - fixup_pack_header_footer(output_fd, pack_hash, + fixup_pack_header_footer(the_hash_algo, output_fd, pack_hash, curr_pack, nr_objects, read_hash, consumed_bytes-the_hash_algo->rawsz); if (!hasheq(read_hash, tail_hash, the_repository->hash_algo)) @@ -2089,11 +2089,12 @@ int cmd_index_pack(int argc, ALLOC_ARRAY(idx_objects, nr_objects); for (i = 0; i < nr_objects; i++) idx_objects[i] = &objects[i].idx; - curr_index = write_idx_file(index_name, idx_objects, nr_objects, &opts, pack_hash); + curr_index = write_idx_file(the_hash_algo, index_name, idx_objects, + nr_objects, &opts, pack_hash); if (rev_index) - curr_rev_index = write_rev_file(rev_index_name, idx_objects, - nr_objects, pack_hash, - opts.flags); + curr_rev_index = write_rev_file(the_hash_algo, rev_index_name, + idx_objects, nr_objects, + pack_hash, opts.flags); free(idx_objects); if (!verify) diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index d51c021d99..7b2dacda51 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -1319,8 +1319,9 @@ static void write_pack_file(void) */ int fd = finalize_hashfile(f, hash, FSYNC_COMPONENT_PACK, 0); - fixup_pack_header_footer(fd, hash, pack_tmp_name, - nr_written, hash, offset); + fixup_pack_header_footer(the_hash_algo, fd, hash, + pack_tmp_name, nr_written, + hash, offset); close(fd); if (write_bitmap_index) { if (write_bitmap_index != WRITE_BITMAP_QUIET) @@ -1368,9 +1369,10 @@ static void write_pack_file(void) if (cruft) pack_idx_opts.flags |= WRITE_MTIMES; - stage_tmp_packfiles(&tmpname, pack_tmp_name, - written_list, nr_written, - &to_pack, &pack_idx_opts, hash, + stage_tmp_packfiles(the_hash_algo, &tmpname, + pack_tmp_name, written_list, + nr_written, &to_pack, + &pack_idx_opts, hash, &idx_tmp_name); if (write_bitmap_index) { diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index 0fb0266cfd..b7ea774609 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -2304,7 +2304,7 @@ static const char *unpack(int err_fd, struct shallow_info *si) if (status) return "index-pack fork failed"; - lockfile = index_pack_lockfile(child.out, NULL); + lockfile = index_pack_lockfile(the_repository, child.out, NULL); if (lockfile) { pack_lockfile = register_tempfile(lockfile); free(lockfile); |
