Skip to content

Commit 5a88583

Browse files
pcloudsgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0778b29 commit 5a88583

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

fetch-pack.c

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,9 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
902902
sort_ref_list(&ref, ref_compare_name);
903903
QSORT(sought, nr_sought, cmp_ref_by_name);
904904

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))
906908
die(_("Server does not support shallow clients"));
907909
if (args->depth > 0 || args->deepen_since || args->deepen_not)
908910
args->deepen = 1;
@@ -935,11 +937,17 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
935937
print_verbose(args, _("Server supports %s"), "allow-reachable-sha1-in-want");
936938
allow_unadvertised_object_request |= ALLOW_REACHABLE_SHA1;
937939
}
938-
if (!server_supports("thin-pack"))
940+
if (server_supports("thin-pack"))
941+
print_verbose(args, _("Server supports %s"), "thin-pack");
942+
else
939943
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
941947
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
943951
args->include_tag = 0;
944952
if (server_supports("ofs-delta"))
945953
print_verbose(args, _("Server supports %s"), "ofs-delta");
@@ -959,15 +967,19 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
959967
print_verbose(args, _("Server version is %.*s"),
960968
agent_len, agent_feature);
961969
}
962-
if (server_supports("deepen-since"))
970+
if (server_supports("deepen-since")) {
971+
print_verbose(args, _("Server supports %s"), "deepen-since");
963972
deepen_since_ok = 1;
964-
else if (args->deepen_since)
973+
} else if (args->deepen_since)
965974
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");
967977
deepen_not_ok = 1;
968-
else if (args->deepen_not)
978+
} else if (args->deepen_not)
969979
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)
971983
die(_("Server does not support --deepen"));
972984

973985
if (!args->no_dependents) {

0 commit comments

Comments
 (0)