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

Re: [PATCH v3 1/1] trace.c, git.c: remove unnecessary parameter to trace_repo_setup()

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 21, 2023, 20:00 UTC
Message-ID
<xmqqttzeeqlk.fsf@gitster.g>
In-Reply-To
<20230219002527.84315-1-mcsm224@gmail.com>
Idriss Fekir <mcsm224@gmail.com> writes:
Show 6 quoted lines
> 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 ;-)
> 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.
Previous: Idriss FekirNext: Idriss Fekir
Message 8 of 9 in “trace.c, git.c: removed unnecessary parameter to trace_repo_setup”
  1. 0/1 [gsoc][patch] trace.c, git.c: removed unnecessary parameter to trace_repo_setupIdriss Fekir, Feb 15, 2023
  2. 1/1 remove parameter (prefix) from trace_repo_setupIdriss Fekir, Feb 15, 2023
  3. Shuqi LiangFeb 15, 2023
  4. Junio C HamanoFeb 15, 2023
  5. 1/1 trace.c, git.c: remove unnecessary parameter to trace_repo_setupIdriss Fekir, Feb 15, 2023
  6. Christian CouderFeb 18, 2023
  7. 1/1 trace.c, git.c: remove unnecessary parameter to trace_repo_setup()Idriss Fekir, Feb 19, 2023
  8. Junio C HamanoFeb 21, 2023
  9. Idriss FekirFeb 22, 2023

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.