From: Idriss Fekir <mcsm224@gmail.com>
To: gitster@pobox.com
Cc: cheskaqiqi@gmail.com, christian.couder@gmail.com,
git@vger.kernel.org, mcsm224@gmail.com
Subject: Re:[PATCH v3 1/1] trace.c, git.c: remove unnecessary parameter to trace_repo_setup()
Date: Wed, 22 Feb 2023 16:38:35 +0100 [thread overview]
Message-ID: <20230222153835.9794-1-mcsm224@gmail.com> (raw)
In-Reply-To: <xmqqttzeeqlk.fsf@gitster.g>
On 2/21/23 21:00, Junio C Hamano wrote:
> Idriss Fekir <mcsm224@gmail.com> writes:
>
>> 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).
>
> The former is the wrapper of the latter, though ;-)
Oh sorry about that, that's what i meant but wrote it in reverse.
>
>> 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.
>
> ... but for commands with neither RUN_SETUP|RUN_SETUP_GENTLY bits
> requested, the prefix is set it to NULL by run_builtin(), and
> setup_git_directory. What value does startup_info->prefix get in
> that case? If we know it will always NULL (and I suspect that is
> the case, but I haven't followed the codepaths myself to find it out
> lately, so you should without taking my word blindly), saying that
> at the same place you mentioned the return value of setup_git_*()
> functions in the first paragraph would make the reasoning perfect.
>
> Otherwise, very nicely done.
>
> Thanks.
>
I did check if startup_info->prefix is *always* set, that doesn't seem
to be the case, but for trace_repo_setup() this doesn't matter as it will
never be called if neither RUN_SETUP nor RUN_SETUP_GENTLY are set
("if (run_setup &&..."). I also think there is a typo in the comment after
that if-statement, it should be "/* set_git_dir().." instead of
"/* get_git_dir()...". I have a question, why isn't startup_info initialized
with default values in setup.c?
Thanks a lot for your valuable feedback.
PS: I'm so sorry if this email has been sent multiple times, i thought it wasn't at first.
Kind regards.
prev parent reply other threads:[~2023-02-22 15:39 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 ` [PATCH v3 1/1] trace.c, git.c: remove unnecessary parameter to trace_repo_setup() Idriss Fekir
2023-02-21 20:00 ` Junio C Hamano
2023-02-22 15:38 ` Idriss Fekir [this message]
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=20230222153835.9794-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).