[PATCH] chore: use prefix from startup_info
DORMANTno replies
From: Dmitry Torilov via GitGitGadget <hidden>
Date: 2021-03-29 22:35:20
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: Dmitry Torilov <redacted>
trace.h: update trace_repo_setup signature
trace.c: update trace_repo_setup implementation
git.c: update trace_repo_setup usage
Signed-off-by: Dmitry Torilov <redacted>
---
[PATCH] trace: use prefix from startup_info
trace.h: update trace_repo_setup signature trace.c: update
trace_repo_setup implementation git.c: update trace_repo_setup usage
I'm new to git, I want to try to make a test contribution.
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-922%2Ftorilov%2Ftrace_repo_setup-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-922/torilov/trace_repo_setup-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/922
git.c | 3 ++-
trace.c | 4 ++--
trace.h | 2 +-
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/git.c b/git.c
index 9bc077a025cb..310cf54e08f6 100644
--- a/git.c
+++ b/git.c@@ -424,6 +424,7 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv) prefix = setup_git_directory_gently(&nongit_ok); } prefix = precompose_argv_prefix(argc, argv, prefix); + startup_info->prefix = prefix; if (use_pager == -1 && p->option & (RUN_SETUP | RUN_SETUP_GENTLY) && !(p->option & DELAY_PAGER_CONFIG)) use_pager = check_pager_config(p->cmd);
@@ -432,7 +433,7 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv) if ((p->option & (RUN_SETUP | RUN_SETUP_GENTLY)) && startup_info->have_repository) /* get_git_dir() may set up repo, avoid that */ - trace_repo_setup(prefix); + trace_repo_setup(); } commit_pager_choice();
diff --git a/trace.c b/trace.c
index f726686fd92f..4c6414683414 100644
--- a/trace.c
+++ b/trace.c@@ -367,9 +367,9 @@ static const char *quote_crnl(const char *path) return new_path.buf; } -/* FIXME: move prefix to startup_info struct and get rid of this arg */ -void trace_repo_setup(const char *prefix) +void trace_repo_setup(void) { + const char *prefix = startup_info->prefix; const char *git_work_tree; char *cwd;
diff --git a/trace.h b/trace.h
index 0dbbad0e41cb..844b3ce47d2b 100644
--- a/trace.h
+++ b/trace.h@@ -93,7 +93,7 @@ extern struct trace_key trace_default_key; extern struct trace_key trace_perf_key; extern struct trace_key trace_setup_key; -void trace_repo_setup(const char *prefix); +void trace_repo_setup(void); /** * Checks whether the trace key is enabled. Used to prevent expensive
base-commit: 84d06cdc06389ae7c462434cb7b1db0980f63860 -- gitgitgadget