git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] chore: use prefix from startup_info

From
DGDmitry Torilov via GitGitGadget <gitgitgadget@gmail.com>
Date
Mar 29, 2021, 22:33 UTC
Message-ID
<pull.922.git.1617057233885.gitgitgadget@gmail.com>
From: Dmitry Torilov <d.torilov@gmail.com>

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 <d.torilov@gmail.com>
---
    [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
Next: Junio C Hamano
Message 1 of 8 in “chore: use prefix from startup_info”
  1. chore: use prefix from startup_infoDmitry Torilov via GitGitGadget, Mar 29, 2021
  2. Junio C HamanoMar 29, 2021
  3. Torsten BögershausenMar 31, 2021
  4. 1/2 precompose_utf8: Make precompose_string_if_needed() publictboegi@web.de, Apr 4, 2021
  5. 2/2 MacOs: Precompose startup_info->prefixtboegi@web.de, Apr 4, 2021
  6. Junio C HamanoApr 4, 2021
  7. 1/2 precompose_utf8: Make precompose_string_if_needed() publictboegi@web.de, Apr 4, 2021
  8. 2/2 MacOs: Precompose startup_info->prefixtboegi@web.de, Apr 4, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.