aboutsummaryrefslogtreecommitdiffstats
path: root/path.c
diff options
context:
space:
mode:
authorBrandon Williams <bmwill@google.com>2017-06-22 11:43:33 -0700
committerJunio C Hamano <gitster@pobox.com>2017-06-23 18:24:34 -0700
commitc14c234f22e0656a61f5718baf155118e6e609c9 (patch)
tree7d3ed4c29cef99e9dfc1d2e043c93c2e1b8068c9 /path.c
parent359efeffc1f16443be18a80b91ba7cd356eb34f1 (diff)
downloadgit-c14c234f22e0656a61f5718baf155118e6e609c9.tar.gz
environment: place key repository state in the_repository
Migrate 'git_dir', 'git_common_dir', 'git_object_dir', 'git_index_file', 'git_graft_file', and 'namespace' to be stored in 'the_repository'. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'path.c')
-rw-r--r--path.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/path.c b/path.c
index c1cb1cf627..e4abea0830 100644
--- a/path.c
+++ b/path.c
@@ -2,6 +2,7 @@
* Utilities for paths and pathnames
*/
#include "cache.h"
+#include "repository.h"
#include "strbuf.h"
#include "string-list.h"
#include "dir.h"
@@ -355,7 +356,7 @@ void report_linked_checkout_garbage(void)
const struct common_dir *p;
int len;
- if (!git_common_dir_env)
+ if (!the_repository->different_commondir)
return;
strbuf_addf(&sb, "%s/", get_git_dir());
len = sb.len;
@@ -374,17 +375,17 @@ void report_linked_checkout_garbage(void)
static void adjust_git_path(struct strbuf *buf, int git_dir_len)
{
const char *base = buf->buf + git_dir_len;
- if (git_graft_env && is_dir_file(base, "info", "grafts"))
+ if (is_dir_file(base, "info", "grafts"))
strbuf_splice(buf, 0, buf->len,
get_graft_file(), strlen(get_graft_file()));
- else if (git_index_env && !strcmp(base, "index"))
+ else if (!strcmp(base, "index"))
strbuf_splice(buf, 0, buf->len,
get_index_file(), strlen(get_index_file()));
- else if (git_db_env && dir_prefix(base, "objects"))
+ else if (dir_prefix(base, "objects"))
replace_dir(buf, git_dir_len + 7, get_object_directory());
else if (git_hooks_path && dir_prefix(base, "hooks"))
replace_dir(buf, git_dir_len + 5, git_hooks_path);
- else if (git_common_dir_env)
+ else if (the_repository->different_commondir)
update_common_dir(buf, git_dir_len, NULL);
}