{"thread":{"id":"51352","subject":"[PATCH 1/3] fetch-pack: move capability names out of i18n strings","startedAt":"2019-06-20T11:59:59Z","lastAt":"2019-06-20T12:00:07Z","messageCount":3,"participants":["Nguyễn Thái Ngọc Duy"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"377652","messageId":"20190620115951.13629-1-pclouds@gmail.com","threadId":"51352","inReplyTo":null,"subject":"[PATCH 1/3] fetch-pack: move capability names out of i18n strings","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2019-06-20T11:59:49Z","receivedAt":"2019-06-20T11:59:59Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"This reduces the work on translators since they only have one string to\ntranslate (and I think it's still enough context to translate). It also\nmakes sure no capability name is translated by accident.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n fetch-pack.c | 18 +++++++++---------\n 1 file changed, 9 insertions(+), 9 deletions(-)\n\ndiff --git a/fetch-pack.c b/fetch-pack.c\nindex 1c10f54e78..0532029f2c 100644\n--- a/fetch-pack.c\n+++ b/fetch-pack.c\n@@ -907,32 +907,32 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,\n \tif (args->depth > 0 || args->deepen_since || args->deepen_not)\n \t\targs->deepen = 1;\n \tif (server_supports(\"multi_ack_detailed\")) {\n-\t\tprint_verbose(args, _(\"Server supports multi_ack_detailed\"));\n+\t\tprint_verbose(args, _(\"Server supports %s\"), \"multi_ack_detailed\");\n \t\tmulti_ack = 2;\n \t\tif (server_supports(\"no-done\")) {\n-\t\t\tprint_verbose(args, _(\"Server supports no-done\"));\n+\t\t\tprint_verbose(args, _(\"Server supports %s\"), \"no-done\");\n \t\t\tif (args->stateless_rpc)\n \t\t\t\tno_done = 1;\n \t\t}\n \t}\n \telse if (server_supports(\"multi_ack\")) {\n-\t\tprint_verbose(args, _(\"Server supports multi_ack\"));\n+\t\tprint_verbose(args, _(\"Server supports %s\"), \"multi_ack\");\n \t\tmulti_ack = 1;\n \t}\n \tif (server_supports(\"side-band-64k\")) {\n-\t\tprint_verbose(args, _(\"Server supports side-band-64k\"));\n+\t\tprint_verbose(args, _(\"Server supports %s\"), \"side-band-64k\");\n \t\tuse_sideband = 2;\n \t}\n \telse if (server_supports(\"side-band\")) {\n-\t\tprint_verbose(args, _(\"Server supports side-band\"));\n+\t\tprint_verbose(args, _(\"Server supports %s\"), \"side-band\");\n \t\tuse_sideband = 1;\n \t}\n \tif (server_supports(\"allow-tip-sha1-in-want\")) {\n-\t\tprint_verbose(args, _(\"Server supports allow-tip-sha1-in-want\"));\n+\t\tprint_verbose(args, _(\"Server supports %s\"), \"allow-tip-sha1-in-want\");\n \t\tallow_unadvertised_object_request |= ALLOW_TIP_SHA1;\n \t}\n \tif (server_supports(\"allow-reachable-sha1-in-want\")) {\n-\t\tprint_verbose(args, _(\"Server supports allow-reachable-sha1-in-want\"));\n+\t\tprint_verbose(args, _(\"Server supports %s\"), \"allow-reachable-sha1-in-want\");\n \t\tallow_unadvertised_object_request |= ALLOW_REACHABLE_SHA1;\n \t}\n \tif (!server_supports(\"thin-pack\"))\n@@ -942,13 +942,13 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,\n \tif (!server_supports(\"include-tag\"))\n \t\targs->include_tag = 0;\n \tif (server_supports(\"ofs-delta\"))\n-\t\tprint_verbose(args, _(\"Server supports ofs-delta\"));\n+\t\tprint_verbose(args, _(\"Server supports %s\"), \"ofs-delta\");\n \telse\n \t\tprefer_ofs_delta = 0;\n \n \tif (server_supports(\"filter\")) {\n \t\tserver_supports_filtering = 1;\n-\t\tprint_verbose(args, _(\"Server supports filter\"));\n+\t\tprint_verbose(args, _(\"Server supports %s\"), \"filter\");\n \t} else if (args->filter_options.choice) {\n \t\twarning(\"filtering not recognized by server, ignoring\");\n \t}\n-- \n2.22.0.rc0.322.g2b0371e29a\n\n"},{"id":"377653","messageId":"20190620115951.13629-2-pclouds@gmail.com","threadId":"51352","inReplyTo":"20190620115951.13629-1-pclouds@gmail.com","subject":"[PATCH 2/3] fetch-pack: print all relevant supported capabilities with -v -v","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2019-06-20T11:59:50Z","receivedAt":"2019-06-20T12:00:03Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"When we check if some capability is supported, we do print something in\nverbose mode. Some capabilities are not printed though (and it made me\nthink it's not supported; I was more used to GIT_TRACE_PACKET) so let's\nprint them all.\n\nIt's a bit more code. And one could argue for printing all supported\ncapabilities the server sends us. But I think it's still valuable this\nway because we see the capabilities that the client cares about.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n fetch-pack.c | 30 +++++++++++++++++++++---------\n 1 file changed, 21 insertions(+), 9 deletions(-)\n\ndiff --git a/fetch-pack.c b/fetch-pack.c\nindex 0532029f2c..de935f8776 100644\n--- a/fetch-pack.c\n+++ b/fetch-pack.c\n@@ -902,7 +902,9 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,\n \tsort_ref_list(&ref, ref_compare_name);\n \tQSORT(sought, nr_sought, cmp_ref_by_name);\n \n-\tif ((args->depth > 0 || is_repository_shallow(the_repository)) && !server_supports(\"shallow\"))\n+\tif (server_supports(\"shallow\"))\n+\t\tprint_verbose(args, _(\"Server supports %s\"), \"shallow\");\n+\telse if (args->depth > 0 || is_repository_shallow(the_repository))\n \t\tdie(_(\"Server does not support shallow clients\"));\n \tif (args->depth > 0 || args->deepen_since || args->deepen_not)\n \t\targs->deepen = 1;\n@@ -935,11 +937,17 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,\n \t\tprint_verbose(args, _(\"Server supports %s\"), \"allow-reachable-sha1-in-want\");\n \t\tallow_unadvertised_object_request |= ALLOW_REACHABLE_SHA1;\n \t}\n-\tif (!server_supports(\"thin-pack\"))\n+\tif (server_supports(\"thin-pack\"))\n+\t\tprint_verbose(args, _(\"Server supports %s\"), \"thin-pack\");\n+\telse\n \t\targs->use_thin_pack = 0;\n-\tif (!server_supports(\"no-progress\"))\n+\tif (server_supports(\"no-progress\"))\n+\t\tprint_verbose(args, _(\"Server supports %s\"), \"no-progress\");\n+\telse\n \t\targs->no_progress = 0;\n-\tif (!server_supports(\"include-tag\"))\n+\tif (server_supports(\"include-tag\"))\n+\t\tprint_verbose(args, _(\"Server supports %s\"), \"include-tag\");\n+\telse\n \t\targs->include_tag = 0;\n \tif (server_supports(\"ofs-delta\"))\n \t\tprint_verbose(args, _(\"Server supports %s\"), \"ofs-delta\");\n@@ -959,15 +967,19 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,\n \t\t\tprint_verbose(args, _(\"Server version is %.*s\"),\n \t\t\t\t      agent_len, agent_feature);\n \t}\n-\tif (server_supports(\"deepen-since\"))\n+\tif (server_supports(\"deepen-since\")) {\n+\t\tprint_verbose(args, _(\"Server supports %s\"), \"deepen-since\");\n \t\tdeepen_since_ok = 1;\n-\telse if (args->deepen_since)\n+\t} else if (args->deepen_since)\n \t\tdie(_(\"Server does not support --shallow-since\"));\n-\tif (server_supports(\"deepen-not\"))\n+\tif (server_supports(\"deepen-not\")) {\n+\t\tprint_verbose(args, _(\"Server supports %s\"), \"deepen-not\");\n \t\tdeepen_not_ok = 1;\n-\telse if (args->deepen_not)\n+\t} else if (args->deepen_not)\n \t\tdie(_(\"Server does not support --shallow-exclude\"));\n-\tif (!server_supports(\"deepen-relative\") && args->deepen_relative)\n+\tif (server_supports(\"deepen-relative\"))\n+\t\tprint_verbose(args, _(\"Server supports %s\"), \"deepen-relative\");\n+\telse if (args->deepen_relative)\n \t\tdie(_(\"Server does not support --deepen\"));\n \n \tif (!args->no_dependents) {\n-- \n2.22.0.rc0.322.g2b0371e29a\n\n"},{"id":"377654","messageId":"20190620115951.13629-3-pclouds@gmail.com","threadId":"51352","inReplyTo":"20190620115951.13629-1-pclouds@gmail.com","subject":"[PATCH 3/3] fetch-pack: print server version at the top in -v -v","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2019-06-20T11:59:51Z","receivedAt":"2019-06-20T12:00:07Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Before the previous patch, the server version is printed after all the\n\"Server supports\" lines. The previous one puts the version in the middle\nof \"Server supports\" group.\n\nInstead of moving it to the bottom, I move it to the top. Version may\nstand out more at the top as we will have even more debug out after\ncapabilities.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n fetch-pack.c | 13 +++++++------\n 1 file changed, 7 insertions(+), 6 deletions(-)\n\ndiff --git a/fetch-pack.c b/fetch-pack.c\nindex de935f8776..445a261f14 100644\n--- a/fetch-pack.c\n+++ b/fetch-pack.c\n@@ -902,6 +902,13 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,\n \tsort_ref_list(&ref, ref_compare_name);\n \tQSORT(sought, nr_sought, cmp_ref_by_name);\n \n+\tif ((agent_feature = server_feature_value(\"agent\", &agent_len))) {\n+\t\tagent_supported = 1;\n+\t\tif (agent_len)\n+\t\t\tprint_verbose(args, _(\"Server version is %.*s\"),\n+\t\t\t\t      agent_len, agent_feature);\n+\t}\n+\n \tif (server_supports(\"shallow\"))\n \t\tprint_verbose(args, _(\"Server supports %s\"), \"shallow\");\n \telse if (args->depth > 0 || is_repository_shallow(the_repository))\n@@ -961,12 +968,6 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,\n \t\twarning(\"filtering not recognized by server, ignoring\");\n \t}\n \n-\tif ((agent_feature = server_feature_value(\"agent\", &agent_len))) {\n-\t\tagent_supported = 1;\n-\t\tif (agent_len)\n-\t\t\tprint_verbose(args, _(\"Server version is %.*s\"),\n-\t\t\t\t      agent_len, agent_feature);\n-\t}\n \tif (server_supports(\"deepen-since\")) {\n \t\tprint_verbose(args, _(\"Server supports %s\"), \"deepen-since\");\n \t\tdeepen_since_ok = 1;\n-- \n2.22.0.rc0.322.g2b0371e29a\n\n"}]}