diff options
| author | Karthik Nayak <karthik.188@gmail.com> | 2025-01-19 12:19:28 +0100 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-01-21 12:36:34 -0800 |
| commit | 7653e9af9b9ddfc465df50203c78f5c8569d8c79 (patch) | |
| tree | 6f2377c0208fe607de7d4d87ff2b1586560eab8d /builtin/pack-objects.c | |
| parent | pack-write: pass repository to `index_pack_lockfile()` (diff) | |
| download | git-7653e9af9b9ddfc465df50203c78f5c8569d8c79.tar.gz git-7653e9af9b9ddfc465df50203c78f5c8569d8c79.zip | |
pack-write: pass hash_algo to `write_idx_file()`
The `write_idx_file()` function uses the global `the_hash_algo` variable
to access the repository's hash_algo. To avoid global variable usage,
pass a hash_algo from the layers above.
Since `stage_tmp_packfiles()` also resides in 'pack-write.c' and calls
`write_idx_file()`, update it to accept a `struct git_hash_algo` as a
parameter and pass it through to the callee.
Altough the layers above could have access to the hash_algo internally,
simply pass in `the_hash_algo`. This avoids any compatibility issues and
bubbles up global variable usage to upper layers which can be eventually
resolved.
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/pack-objects.c')
| -rw-r--r-- | builtin/pack-objects.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index 6188e82059..a6828002c2 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -1368,9 +1368,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) { |
