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>
This commit is contained in:
committed by
Junio C Hamano
parent
e2f6f76585
commit
7653e9af9b
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user