Skip to contentSkip to conversation

http-fetch: invoke trace2_cmd_name()

PATCH In review Jonathan Tan 2 participants 2 messages Dec 12, 2022 – Dec 13, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 http-fetch: invoke trace2_cmd_name()

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.

---
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(+)
http-fetch.c +3 -0
index 31bc5c7767..258fec2068 100644
@@ -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) {
Signature · 1 line
2.39.0.rc1.256.g54fd8350bd-goog
#1 lore raw
Quoted 31 lines · Jonathan Tan

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.

---
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(+)
http-fetch.c +1 -0
index 31bc5c7767..258fec2068 100644
@@ -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";

http-fetch.c int cmd_main(int argc, const char **argv) · line 145

Quoted 8 lines
http-fetch.c +2 -0
@@ -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