Skip to content

Commit 17ab64e

Browse files
user062gitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d9d677b commit 17ab64e

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

git.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
430430
use_pager = 1;
431431
if (run_setup && startup_info->have_repository)
432432
/* get_git_dir() may set up repo, avoid that */
433-
trace_repo_setup(prefix);
433+
trace_repo_setup();
434434
commit_pager_choice();
435435

436436
if (!help && p->option & NEED_WORK_TREE)

trace.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,10 +291,9 @@ static const char *quote_crnl(const char *path)
291291
return new_path.buf;
292292
}
293293

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)
296295
{
297-
const char *git_work_tree;
296+
const char *git_work_tree, *prefix = startup_info->prefix;
298297
char *cwd;
299298

300299
if (!trace_want(&trace_setup_key))
@@ -305,7 +304,7 @@ void trace_repo_setup(const char *prefix)
305304
if (!(git_work_tree = get_git_work_tree()))
306305
git_work_tree = "(null)";
307306

308-
if (!prefix)
307+
if (!startup_info->prefix)
309308
prefix = "(null)";
310309

311310
trace_printf_key(&trace_setup_key, "setup: git_dir: %s\n", quote_crnl(get_git_dir()));

trace.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ extern struct trace_key trace_default_key;
9393
extern struct trace_key trace_perf_key;
9494
extern struct trace_key trace_setup_key;
9595

96-
void trace_repo_setup(const char *prefix);
96+
void trace_repo_setup(void);
9797

9898
/**
9999
* Checks whether the trace key is enabled. Used to prevent expensive

0 commit comments

Comments
 (0)