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