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

Re: [PATCH] http-fetch: invoke trace2_cmd_name()

From
JHJeff Hostetler <git@jeffhostetler.com>
Date
Dec 13, 2022, 20:15 UTC
Message-ID
<b9dc32bb-628c-4056-4c16-21bd51ad94fc@jeffhostetler.com>
In-Reply-To
<20221212224630.2553391-1-jonathantanmy@google.com>
On 12/12/22 5:46 PM, Jonathan Tan wrote:
Show 39 quoted lines
> ee4512ed48 ("trace2: create new combined trace facility", 2019-02-
> 22) introduced trace2_cmd_name() and taught both the Git built-ins and
> some non-built-ins to use it. However, http-fetch was not one of them
> (perhaps due to its low usage at the time).
> 
> Teach http-fetch to invoke this function. After this patch, this
> function will be invoked right after argument parsing, just like in
> remote-curl.c.
> 
> Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
> ---
> This was discovered at $DAYJOB after we noticed that there were command
> names missing in the trace whenever a user did a fetch that involved
> packfile offloading.
> ---
>   http-fetch.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/http-fetch.c b/http-fetch.c
> index 31bc5c7767..258fec2068 100644
> --- a/http-fetch.c
> +++ b/http-fetch.c
> @@ -5,6 +5,7 @@
>   #include "walker.h"
>   #include "strvec.h"
>   #include "urlmatch.h"
> +#include "trace2.h"
>   
>   static const char http_fetch_usage[] = "git http-fetch "
>   "[-c] [-t] [-a] [-v] [--recover] [-w ref] [--stdin | --packfile=hash | commit-id] url";
> @@ -137,6 +138,8 @@ int cmd_main(int argc, const char **argv)
>   	if (nongit)
>   		die(_("not a git repository"));
>   
> +	trace2_cmd_name("http-fetch");
> +
>   	git_config(git_default_config, NULL);
>   
>   	if (packfile) {
LGTM

Thanks for catching this. Jeff

Previous: Jonathan Tan
Message 2 of 2 in “http-fetch: invoke trace2_cmd_name()”
  1. http-fetch: invoke trace2_cmd_name()Jonathan Tan, Dec 12, 2022
  2. Jeff HostetlerDec 13, 2022

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.