ls-remote: set packet_trace_identity(<name>)

Set packet_trace_identity() for ls-remote. This replaces the generic "git" identity in GIT_TRACE_PACKET=<file> traces to "ls-remote", e.g.: [...] packet: upload-pack> version 2 [...] packet: upload-pack> agent=git/2.32.0-dev [...] packet: ls-remote< version 2 [...] packet: ls-remote< agent=git/2.32.0-dev Where in an "git ls-remote file://<path>" dialog ">" is the sender (or "to the server") and "<" is the recipient (or "received by the client"). Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Aug 23, 2021 at 15:17 UTC f58c7468cde9f4eb6be0f9cc11ad1d140a8a2657
2 files changed +5 -3
builtin/ls-remote.c
+2
@@ -84,6 +84,8 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
84 PARSE_OPT_STOP_AT_NON_OPTION);
85 dest = argv[0];
86
87 + packet_trace_identity("ls-remote");
88 +
89 UNLEAK(sorting);
90
91 if (argc > 1) {
t/t5702-protocol-v2.sh
+3 -3
@@ -27,9 +27,9 @@ test_expect_success 'list refs with git:// using protocol v2' '
27 ls-remote --symref "$GIT_DAEMON_URL/parent" >actual &&
28
29 # Client requested to use protocol v2
30 - grep "git> .*\\\0\\\0version=2\\\0$" log &&
30 + grep "ls-remote> .*\\\0\\\0version=2\\\0$" log &&
31 # Server responded using protocol v2
32 - grep "git< version 2" log &&
32 + grep "ls-remote< version 2" log &&
33
34 git ls-remote --symref "$GIT_DAEMON_URL/parent" >expect &&
35 test_cmp expect actual
@@ -151,7 +151,7 @@ test_expect_success 'list refs with file:// using protocol v2' '
151 ls-remote --symref "file://$(pwd)/file_parent" >actual &&
152
153 # Server responded using protocol v2
154 - grep "git< version 2" log &&
154 + grep "ls-remote< version 2" log &&
155
156 git ls-remote --symref "file://$(pwd)/file_parent" >expect &&
157 test_cmp expect actual