git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 1/3] fetch-pack: move capability names out of i18n strings
@ 2019-06-20 11:59 Nguyễn Thái Ngọc Duy
  2019-06-20 11:59 ` [PATCH 2/3] fetch-pack: print all relevant supported capabilities with -v -v Nguyễn Thái Ngọc Duy
  2019-06-20 11:59 ` [PATCH 3/3] fetch-pack: print server version at the top in " Nguyễn Thái Ngọc Duy
  0 siblings, 2 replies; 3+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2019-06-20 11:59 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

This reduces the work on translators since they only have one string to
translate (and I think it's still enough context to translate). It also
makes sure no capability name is translated by accident.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 fetch-pack.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/fetch-pack.c b/fetch-pack.c
index 1c10f54e78..0532029f2c 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -907,32 +907,32 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
 	if (args->depth > 0 || args->deepen_since || args->deepen_not)
 		args->deepen = 1;
 	if (server_supports("multi_ack_detailed")) {
-		print_verbose(args, _("Server supports multi_ack_detailed"));
+		print_verbose(args, _("Server supports %s"), "multi_ack_detailed");
 		multi_ack = 2;
 		if (server_supports("no-done")) {
-			print_verbose(args, _("Server supports no-done"));
+			print_verbose(args, _("Server supports %s"), "no-done");
 			if (args->stateless_rpc)
 				no_done = 1;
 		}
 	}
 	else if (server_supports("multi_ack")) {
-		print_verbose(args, _("Server supports multi_ack"));
+		print_verbose(args, _("Server supports %s"), "multi_ack");
 		multi_ack = 1;
 	}
 	if (server_supports("side-band-64k")) {
-		print_verbose(args, _("Server supports side-band-64k"));
+		print_verbose(args, _("Server supports %s"), "side-band-64k");
 		use_sideband = 2;
 	}
 	else if (server_supports("side-band")) {
-		print_verbose(args, _("Server supports side-band"));
+		print_verbose(args, _("Server supports %s"), "side-band");
 		use_sideband = 1;
 	}
 	if (server_supports("allow-tip-sha1-in-want")) {
-		print_verbose(args, _("Server supports allow-tip-sha1-in-want"));
+		print_verbose(args, _("Server supports %s"), "allow-tip-sha1-in-want");
 		allow_unadvertised_object_request |= ALLOW_TIP_SHA1;
 	}
 	if (server_supports("allow-reachable-sha1-in-want")) {
-		print_verbose(args, _("Server supports allow-reachable-sha1-in-want"));
+		print_verbose(args, _("Server supports %s"), "allow-reachable-sha1-in-want");
 		allow_unadvertised_object_request |= ALLOW_REACHABLE_SHA1;
 	}
 	if (!server_supports("thin-pack"))
@@ -942,13 +942,13 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
 	if (!server_supports("include-tag"))
 		args->include_tag = 0;
 	if (server_supports("ofs-delta"))
-		print_verbose(args, _("Server supports ofs-delta"));
+		print_verbose(args, _("Server supports %s"), "ofs-delta");
 	else
 		prefer_ofs_delta = 0;
 
 	if (server_supports("filter")) {
 		server_supports_filtering = 1;
-		print_verbose(args, _("Server supports filter"));
+		print_verbose(args, _("Server supports %s"), "filter");
 	} else if (args->filter_options.choice) {
 		warning("filtering not recognized by server, ignoring");
 	}
-- 
2.22.0.rc0.322.g2b0371e29a


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/3] fetch-pack: print all relevant supported capabilities with -v -v
  2019-06-20 11:59 [PATCH 1/3] fetch-pack: move capability names out of i18n strings Nguyễn Thái Ngọc Duy
@ 2019-06-20 11:59 ` Nguyễn Thái Ngọc Duy
  2019-06-20 11:59 ` [PATCH 3/3] fetch-pack: print server version at the top in " Nguyễn Thái Ngọc Duy
  1 sibling, 0 replies; 3+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2019-06-20 11:59 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

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>
---
 fetch-pack.c | 30 +++++++++++++++++++++---------
 1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/fetch-pack.c b/fetch-pack.c
index 0532029f2c..de935f8776 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -902,7 +902,9 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
 	sort_ref_list(&ref, ref_compare_name);
 	QSORT(sought, nr_sought, cmp_ref_by_name);
 
-	if ((args->depth > 0 || is_repository_shallow(the_repository)) && !server_supports("shallow"))
+	if (server_supports("shallow"))
+		print_verbose(args, _("Server supports %s"), "shallow");
+	else if (args->depth > 0 || is_repository_shallow(the_repository))
 		die(_("Server does not support shallow clients"));
 	if (args->depth > 0 || args->deepen_since || args->deepen_not)
 		args->deepen = 1;
@@ -935,11 +937,17 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
 		print_verbose(args, _("Server supports %s"), "allow-reachable-sha1-in-want");
 		allow_unadvertised_object_request |= ALLOW_REACHABLE_SHA1;
 	}
-	if (!server_supports("thin-pack"))
+	if (server_supports("thin-pack"))
+		print_verbose(args, _("Server supports %s"), "thin-pack");
+	else
 		args->use_thin_pack = 0;
-	if (!server_supports("no-progress"))
+	if (server_supports("no-progress"))
+		print_verbose(args, _("Server supports %s"), "no-progress");
+	else
 		args->no_progress = 0;
-	if (!server_supports("include-tag"))
+	if (server_supports("include-tag"))
+		print_verbose(args, _("Server supports %s"), "include-tag");
+	else
 		args->include_tag = 0;
 	if (server_supports("ofs-delta"))
 		print_verbose(args, _("Server supports %s"), "ofs-delta");
@@ -959,15 +967,19 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
 			print_verbose(args, _("Server version is %.*s"),
 				      agent_len, agent_feature);
 	}
-	if (server_supports("deepen-since"))
+	if (server_supports("deepen-since")) {
+		print_verbose(args, _("Server supports %s"), "deepen-since");
 		deepen_since_ok = 1;
-	else if (args->deepen_since)
+	} else if (args->deepen_since)
 		die(_("Server does not support --shallow-since"));
-	if (server_supports("deepen-not"))
+	if (server_supports("deepen-not")) {
+		print_verbose(args, _("Server supports %s"), "deepen-not");
 		deepen_not_ok = 1;
-	else if (args->deepen_not)
+	} else if (args->deepen_not)
 		die(_("Server does not support --shallow-exclude"));
-	if (!server_supports("deepen-relative") && args->deepen_relative)
+	if (server_supports("deepen-relative"))
+		print_verbose(args, _("Server supports %s"), "deepen-relative");
+	else if (args->deepen_relative)
 		die(_("Server does not support --deepen"));
 
 	if (!args->no_dependents) {
-- 
2.22.0.rc0.322.g2b0371e29a


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 3/3] fetch-pack: print server version at the top in -v -v
  2019-06-20 11:59 [PATCH 1/3] fetch-pack: move capability names out of i18n strings Nguyễn Thái Ngọc Duy
  2019-06-20 11:59 ` [PATCH 2/3] fetch-pack: print all relevant supported capabilities with -v -v Nguyễn Thái Ngọc Duy
@ 2019-06-20 11:59 ` Nguyễn Thái Ngọc Duy
  1 sibling, 0 replies; 3+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2019-06-20 11:59 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

Before the previous patch, the server version is printed after all the
"Server supports" lines. The previous one puts the version in the middle
of "Server supports" group.

Instead of moving it to the bottom, I move it to the top. Version may
stand out more at the top as we will have even more debug out after
capabilities.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 fetch-pack.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/fetch-pack.c b/fetch-pack.c
index de935f8776..445a261f14 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -902,6 +902,13 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
 	sort_ref_list(&ref, ref_compare_name);
 	QSORT(sought, nr_sought, cmp_ref_by_name);
 
+	if ((agent_feature = server_feature_value("agent", &agent_len))) {
+		agent_supported = 1;
+		if (agent_len)
+			print_verbose(args, _("Server version is %.*s"),
+				      agent_len, agent_feature);
+	}
+
 	if (server_supports("shallow"))
 		print_verbose(args, _("Server supports %s"), "shallow");
 	else if (args->depth > 0 || is_repository_shallow(the_repository))
@@ -961,12 +968,6 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
 		warning("filtering not recognized by server, ignoring");
 	}
 
-	if ((agent_feature = server_feature_value("agent", &agent_len))) {
-		agent_supported = 1;
-		if (agent_len)
-			print_verbose(args, _("Server version is %.*s"),
-				      agent_len, agent_feature);
-	}
 	if (server_supports("deepen-since")) {
 		print_verbose(args, _("Server supports %s"), "deepen-since");
 		deepen_since_ok = 1;
-- 
2.22.0.rc0.322.g2b0371e29a


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-06-20 12:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-20 11:59 [PATCH 1/3] fetch-pack: move capability names out of i18n strings Nguyễn Thái Ngọc Duy
2019-06-20 11:59 ` [PATCH 2/3] fetch-pack: print all relevant supported capabilities with -v -v Nguyễn Thái Ngọc Duy
2019-06-20 11:59 ` [PATCH 3/3] fetch-pack: print server version at the top in " Nguyễn Thái Ngọc Duy

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).