From: Idriss Fekir <mcsm224@gmail.com>
To: git@vger.kernel.org
Cc: idriss fekir <mcsm224@gmail.com>,
gitster@pobox.com, cheskaqiqi@gmail.com,
christian.couder@gmail.com
Subject: [PATCH v3 1/1] trace.c, git.c: remove unnecessary parameter to trace_repo_setup()
Date: Sun, 19 Feb 2023 01:25:27 +0100 [thread overview]
Message-ID: <20230219002527.84315-1-mcsm224@gmail.com> (raw)
In-Reply-To: <20230215104246.8919-1-mcsm224@gmail.com>
From: idriss fekir <mcsm224@gmail.com>
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>
---
Thank you very much, Christian Couder.
git.c | 2 +-
trace.c | 7 +++----
trace.h | 2 +-
3 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/git.c b/git.c
index 96b0a2837d..6171fd6769 100644
--- a/git.c
+++ b/git.c
@@ -430,7 +430,7 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
use_pager = 1;
if (run_setup && startup_info->have_repository)
/* get_git_dir() may set up repo, avoid that */
- trace_repo_setup(prefix);
+ trace_repo_setup();
commit_pager_choice();
if (!help && p->option & NEED_WORK_TREE)
diff --git a/trace.c b/trace.c
index 794a087c21..efa4e2d8e0 100644
--- a/trace.c
+++ b/trace.c
@@ -291,10 +291,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 *git_work_tree;
+ const char *git_work_tree, *prefix = startup_info->prefix;
char *cwd;
if (!trace_want(&trace_setup_key))
@@ -305,7 +304,7 @@ void trace_repo_setup(const char *prefix)
if (!(git_work_tree = get_git_work_tree()))
git_work_tree = "(null)";
- if (!prefix)
+ if (!startup_info->prefix)
prefix = "(null)";
trace_printf_key(&trace_setup_key, "setup: git_dir: %s\n", quote_crnl(get_git_dir()));
diff --git a/trace.h b/trace.h
index 4e771f86ac..b6e35b9470 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
--
2.39.2
next prev parent reply other threads:[~2023-02-19 0:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-15 10:42 [PATCH 0/1] [gsoc][patch] trace.c, git.c: removed unnecessary parameter to trace_repo_setup Idriss Fekir
2023-02-15 10:42 ` [PATCH 1/1] remove parameter (prefix) from trace_repo_setup Idriss Fekir
2023-02-15 17:55 ` Re:[PATCH 1/1] [gsoc][patch] trace.c, git.c: removed unnecessary parameter to trace_repo_setup Shuqi Liang
2023-02-15 17:56 ` [PATCH 1/1] remove parameter (prefix) from trace_repo_setup Junio C Hamano
2023-02-15 23:14 ` [PATCH 1/1] trace.c, git.c: remove unnecessary parameter to trace_repo_setup Idriss Fekir
2023-02-18 18:35 ` Christian Couder
2023-02-19 0:25 ` Idriss Fekir [this message]
2023-02-21 20:00 ` [PATCH v3 1/1] trace.c, git.c: remove unnecessary parameter to trace_repo_setup() Junio C Hamano
2023-02-22 15:38 ` Idriss Fekir
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230219002527.84315-1-mcsm224@gmail.com \
--to=mcsm224@gmail.com \
--cc=cheskaqiqi@gmail.com \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).