packfile: pass down repository to odb_pack_name
The function `odb_pack_name` currently relies on the global variable `the_repository`. To eliminate global variable usage in `packfile.c`, we should progressively shift the dependency on the_repository to higher layers. 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
4f9e6bd492
commit
873b00597b
@ -1479,7 +1479,7 @@ static void write_special_file(const char *suffix, const char *msg,
|
||||
if (pack_name)
|
||||
filename = derive_filename(pack_name, "pack", suffix, &name_buf);
|
||||
else
|
||||
filename = odb_pack_name(&name_buf, hash, suffix);
|
||||
filename = odb_pack_name(the_repository, &name_buf, hash, suffix);
|
||||
|
||||
fd = odb_pack_keep(filename);
|
||||
if (fd < 0) {
|
||||
@ -1507,7 +1507,7 @@ static void rename_tmp_packfile(const char **final_name,
|
||||
{
|
||||
if (!*final_name || strcmp(*final_name, curr_name)) {
|
||||
if (!*final_name)
|
||||
*final_name = odb_pack_name(name, hash, ext);
|
||||
*final_name = odb_pack_name(the_repository, name, hash, ext);
|
||||
if (finalize_object_file(curr_name, *final_name))
|
||||
die(_("unable to rename temporary '*.%s' file to '%s'"),
|
||||
ext, *final_name);
|
||||
|
Reference in New Issue
Block a user