environment: make get_object_directory() accept a repository
The `get_object_directory()` function retrieves the path to the object directory for `the_repository`. Make it accept a `struct repository` such that it can work on arbitrary repositories and make it part of the repository subsystem. This reduces our reliance on `the_repository` and clarifies scope. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
661624a4f6
commit
a3673f4898
@@ -1240,7 +1240,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
|
||||
if (write_midx && write_bitmaps) {
|
||||
struct strbuf path = STRBUF_INIT;
|
||||
|
||||
strbuf_addf(&path, "%s/%s_XXXXXX", get_object_directory(),
|
||||
strbuf_addf(&path, "%s/%s_XXXXXX", repo_get_object_directory(the_repository),
|
||||
"bitmap-ref-tips");
|
||||
|
||||
refs_snapshot = xmks_tempfile(path.buf);
|
||||
@@ -1249,7 +1249,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
|
||||
strbuf_release(&path);
|
||||
}
|
||||
|
||||
packdir = mkpathdup("%s/pack", get_object_directory());
|
||||
packdir = mkpathdup("%s/pack", repo_get_object_directory(the_repository));
|
||||
packtmp_name = xstrfmt(".tmp-%d-pack", (int)getpid());
|
||||
packtmp = mkpathdup("%s/%s", packdir, packtmp_name);
|
||||
|
||||
@@ -1519,7 +1519,8 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
|
||||
unsigned flags = 0;
|
||||
if (git_env_bool(GIT_TEST_MULTI_PACK_INDEX_WRITE_INCREMENTAL, 0))
|
||||
flags |= MIDX_WRITE_INCREMENTAL;
|
||||
write_midx_file(get_object_directory(), NULL, NULL, flags);
|
||||
write_midx_file(repo_get_object_directory(the_repository),
|
||||
NULL, NULL, flags);
|
||||
}
|
||||
|
||||
cleanup:
|
||||
|
||||
Reference in New Issue
Block a user