Git fork

trace: stop using `the_repository`

Stop using `the_repository` in the "trace" subsystem by passing in a
repository when setting up tracing.

Adjust the only caller accordingly.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Patrick Steinhardt and committed by
Junio C Hamano
bd0c0fb7 59b6131a

+8 -7
+1 -1
git.c
··· 467 467 use_pager = 1; 468 468 if (run_setup && startup_info->have_repository) 469 469 /* get_git_dir() may set up repo, avoid that */ 470 - trace_repo_setup(); 470 + trace_repo_setup(the_repository); 471 471 commit_pager_choice(); 472 472 473 473 if (!help && p->option & NEED_WORK_TREE)
+4 -5
trace.c
··· 21 21 * along with this program; if not, see <https://www.gnu.org/licenses/>. 22 22 */ 23 23 24 - #define USE_THE_REPOSITORY_VARIABLE 25 24 #define DISABLE_SIGN_COMPARE_WARNINGS 26 25 27 26 #include "git-compat-util.h" ··· 298 297 return new_path.buf; 299 298 } 300 299 301 - void trace_repo_setup(void) 300 + void trace_repo_setup(struct repository *r) 302 301 { 303 302 const char *git_work_tree, *prefix = startup_info->prefix; 304 303 char *cwd; ··· 308 307 309 308 cwd = xgetcwd(); 310 309 311 - if (!(git_work_tree = repo_get_work_tree(the_repository))) 310 + if (!(git_work_tree = repo_get_work_tree(r))) 312 311 git_work_tree = "(null)"; 313 312 314 313 if (!startup_info->prefix) 315 314 prefix = "(null)"; 316 315 317 - trace_printf_key(&trace_setup_key, "setup: git_dir: %s\n", quote_crnl(repo_get_git_dir(the_repository))); 318 - trace_printf_key(&trace_setup_key, "setup: git_common_dir: %s\n", quote_crnl(repo_get_common_dir(the_repository))); 316 + trace_printf_key(&trace_setup_key, "setup: git_dir: %s\n", quote_crnl(repo_get_git_dir(r))); 317 + trace_printf_key(&trace_setup_key, "setup: git_common_dir: %s\n", quote_crnl(repo_get_common_dir(r))); 319 318 trace_printf_key(&trace_setup_key, "setup: worktree: %s\n", quote_crnl(git_work_tree)); 320 319 trace_printf_key(&trace_setup_key, "setup: cwd: %s\n", quote_crnl(cwd)); 321 320 trace_printf_key(&trace_setup_key, "setup: prefix: %s\n", quote_crnl(prefix));
+3 -1
trace.h
··· 92 92 extern struct trace_key trace_perf_key; 93 93 extern struct trace_key trace_setup_key; 94 94 95 - void trace_repo_setup(void); 95 + struct repository; 96 + 97 + void trace_repo_setup(struct repository *r); 96 98 97 99 /** 98 100 * Checks whether the trace key is enabled. Used to prevent expensive