environment: store worktree in the_repository

Migrate 'work_tree' to be stored in 'the_repository'. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Brandon Williams committed Jun 22, 2017 at 11:43 UTC b4158732827af925592fc074ea5d0fe7b485e547
1 file changed +4 -5
environment.c
+4 -5
@@ -96,7 +96,6 @@ int ignore_untracked_cache_config;
96
97 /* This is set by setup_git_dir_gently() and/or git_default_config() */
98 char *git_work_tree_cfg;
99 -static char *work_tree;
99
100 static const char *namespace;
101
@@ -223,19 +222,19 @@ void set_git_work_tree(const char *new_work_tree)
222 {
223 if (git_work_tree_initialized) {
224 new_work_tree = real_path(new_work_tree);
226 - if (strcmp(new_work_tree, work_tree))
225 + if (strcmp(new_work_tree, the_repository->worktree))
226 die("internal error: work tree has already been set\n"
227 "Current worktree: %s\nNew worktree: %s",
229 - work_tree, new_work_tree);
228 + the_repository->worktree, new_work_tree);
229 return;
230 }
231 git_work_tree_initialized = 1;
233 - work_tree = real_pathdup(new_work_tree, 1);
232 + repo_set_worktree(the_repository, new_work_tree);
233 }
234
235 const char *get_git_work_tree(void)
236 {
238 - return work_tree;
237 + return the_repository->worktree;
238 }
239
240 char *get_object_directory(void)