fetch-pack: print all relevant supported capabilities with -v -v
When we check if some capability is supported, we do print something in verbose mode. Some capabilities are not printed though (and it made me think it's not supported; I was more used to GIT_TRACE_PACKET) so let's print them all. It's a bit more code. And one could argue for printing all supported capabilities the server sends us. But I think it's still valuable this way because we see the capabilities that the client cares about. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy committed
Jun 20, 2019 at 18:59 UTC
5a88583b0b241c335b4baf2ccd9b04bc1650efcb
1 file changed
+21
-9
fetch-pack.c
+21
-9
@@ -902,7 +902,9 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
902
sort_ref_list(&ref, ref_compare_name);
903
QSORT(sought, nr_sought, cmp_ref_by_name);
904
905
- if ((args->depth > 0 || is_repository_shallow(the_repository)) && !server_supports("shallow"))
905
+ if (server_supports("shallow"))
906
+ print_verbose(args, _("Server supports %s"), "shallow");
907
+ else if (args->depth > 0 || is_repository_shallow(the_repository))
908
die(_("Server does not support shallow clients"));
909
if (args->depth > 0 || args->deepen_since || args->deepen_not)
910
args->deepen = 1;
@@ -935,11 +937,17 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
937
print_verbose(args, _("Server supports %s"), "allow-reachable-sha1-in-want");
938
allow_unadvertised_object_request |= ALLOW_REACHABLE_SHA1;
939
}
938
- if (!server_supports("thin-pack"))
940
+ if (server_supports("thin-pack"))
941
+ print_verbose(args, _("Server supports %s"), "thin-pack");
942
+ else
943
args->use_thin_pack = 0;
940
- if (!server_supports("no-progress"))
944
+ if (server_supports("no-progress"))
945
+ print_verbose(args, _("Server supports %s"), "no-progress");
946
+ else
947
args->no_progress = 0;
942
- if (!server_supports("include-tag"))
948
+ if (server_supports("include-tag"))
949
+ print_verbose(args, _("Server supports %s"), "include-tag");
950
+ else
951
args->include_tag = 0;
952
if (server_supports("ofs-delta"))
953
print_verbose(args, _("Server supports %s"), "ofs-delta");
@@ -959,15 +967,19 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
967
print_verbose(args, _("Server version is %.*s"),
968
agent_len, agent_feature);
969
}
962
- if (server_supports("deepen-since"))
970
+ if (server_supports("deepen-since")) {
971
+ print_verbose(args, _("Server supports %s"), "deepen-since");
972
deepen_since_ok = 1;
964
- else if (args->deepen_since)
973
+ } else if (args->deepen_since)
974
die(_("Server does not support --shallow-since"));
966
- if (server_supports("deepen-not"))
975
+ if (server_supports("deepen-not")) {
976
+ print_verbose(args, _("Server supports %s"), "deepen-not");
977
deepen_not_ok = 1;
968
- else if (args->deepen_not)
978
+ } else if (args->deepen_not)
979
die(_("Server does not support --shallow-exclude"));
970
- if (!server_supports("deepen-relative") && args->deepen_relative)
980
+ if (server_supports("deepen-relative"))
981
+ print_verbose(args, _("Server supports %s"), "deepen-relative");
982
+ else if (args->deepen_relative)
983
die(_("Server does not support --deepen"));
984
985
if (!args->no_dependents) {