trace.c, git.c: remove unnecessary parameter to trace_repo_setup()
trace_repo_setup() of trace.c is called with the argument 'prefix' from only one location, run_builtin of git.c, which sets 'prefix' to the return value of setup_git_directory() or setup_git_directory_gently() (a wrapper of the former). Now that "prefix" is in startup_info there is no need for the parameter of trace_repo_setup() because setup_git_directory() sets "startup_info->prefix" to the same value it returns. It would be less confusing to use "prefix" from startup_info instead of passing it as an argument. Signed-off-by: Idriss Fekir <mcsm224@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
idriss fekir committed
Feb 19, 2023 at 01:25 UTC
17ab64e1b57b84d551a10e516d2722367e00e76c
3 files changed
+5
-6
git.c
+1
-1
@@ -430,7 +430,7 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
430
use_pager = 1;
431
if (run_setup && startup_info->have_repository)
432
/* get_git_dir() may set up repo, avoid that */
433
- trace_repo_setup(prefix);
433
+ trace_repo_setup();
434
commit_pager_choice();
435
436
if (!help && p->option & NEED_WORK_TREE)
trace.c
+3
-4
@@ -291,10 +291,9 @@ static const char *quote_crnl(const char *path)
291
return new_path.buf;
292
}
293
294
-/* FIXME: move prefix to startup_info struct and get rid of this arg */
295
-void trace_repo_setup(const char *prefix)
294
+void trace_repo_setup(void)
295
{
297
- const char *git_work_tree;
296
+ const char *git_work_tree, *prefix = startup_info->prefix;
297
char *cwd;
298
299
if (!trace_want(&trace_setup_key))
@@ -305,7 +304,7 @@ void trace_repo_setup(const char *prefix)
304
if (!(git_work_tree = get_git_work_tree()))
305
git_work_tree = "(null)";
306
308
- if (!prefix)
307
+ if (!startup_info->prefix)
308
prefix = "(null)";
309
310
trace_printf_key(&trace_setup_key, "setup: git_dir: %s\n", quote_crnl(get_git_dir()));
trace.h
+1
-1
@@ -93,7 +93,7 @@ extern struct trace_key trace_default_key;
93
extern struct trace_key trace_perf_key;
94
extern struct trace_key trace_setup_key;
95
96
-void trace_repo_setup(const char *prefix);
96
+void trace_repo_setup(void);
97
98
/**
99
* Checks whether the trace key is enabled. Used to prevent expensive