summaryrefslogtreecommitdiffstats
path: root/cache-tree.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-09-12 13:29:24 +0200
committerJunio C Hamano <gitster@pobox.com>2024-09-12 19:15:39 +0200
commit246deeac9517d6daba89bfcf6de6d290e39af585 (patch)
treed604806493140d8f3f9e26f705c749b4a0535311 /cache-tree.c
parentThe tenth batch (diff)
downloadgit-246deeac9517d6daba89bfcf6de6d290e39af585.tar.xz
git-246deeac9517d6daba89bfcf6de6d290e39af585.zip
environment: make `get_git_dir()` accept a repository
The `get_git_dir()` function retrieves the path to the Git 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>
Diffstat (limited to 'cache-tree.c')
-rw-r--r--cache-tree.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/cache-tree.c b/cache-tree.c
index 50610c3f3c..b482167a69 100644
--- a/cache-tree.c
+++ b/cache-tree.c
@@ -1,7 +1,6 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "git-compat-util.h"
-#include "environment.h"
#include "hex.h"
#include "lockfile.h"
#include "tree.h"
@@ -12,6 +11,7 @@
#include "object-store-ll.h"
#include "read-cache-ll.h"
#include "replace-object.h"
+#include "repository.h"
#include "promisor-remote.h"
#include "trace.h"
#include "trace2.h"
@@ -725,7 +725,8 @@ int write_index_as_tree(struct object_id *oid, struct index_state *index_state,
hold_lock_file_for_update(&lock_file, index_path, LOCK_DIE_ON_ERROR);
- entries = read_index_from(index_state, index_path, get_git_dir());
+ entries = read_index_from(index_state, index_path,
+ repo_get_git_dir(the_repository));
if (entries < 0) {
ret = WRITE_TREE_UNREADABLE_INDEX;
goto out;