threads / discuss / 60935

[Improvements on messages 0/5] Disambuiguate between options and commands

Subject: [Improvements on messages 0/5] Disambuiguate between options and commands

## tl;dr

9 messages between Feb 16, 2024 and Mar 5, 2024.

replies: 8people: 3as markdown or json

Alexander Shopov· Feb 16, 2024, 10:15 UTC · lore

These are trivial fixes to messages. They make sure commands and options are markes as such. This will help translators and end users. This will also reduce the special cases Jiang Xin keeps for git-po-helper which will ease maintenance.

I am basing these on maint but I have also checked that they ar still relevant by cherry picking on top of latest and next.

Each patch contains a single message fix. Each patch is sent to
 - This list
 - Jiang Xin
 - Junio C Hamano
 - The developer who last edited the line I am changing
These are nice to be merged but this is not urgent.
Alexander Shopov (5):
  rebase: trivial fix of error message
  transport-helper.c: trivial fix of error message
  builtin/remote.c: trivial fix of error message
  builtin/clone.c: trivial fix of message
  revision.c: trivial fix to message
 builtin/clone.c    | 2 +-
 builtin/rebase.c   | 2 +-
 builtin/remote.c   | 2 +-
 revision.c         | 2 +-
 transport-helper.c | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

-- 2.43.2

Alexander Shopov· Feb 16, 2024, 10:15 UTC · re: Alexander Shopov · lore

[Improvements on messages 1/5] rebase: trivial fix of error message

Mark --rebase-merges as option rather than variable name
Signed-off-by: Alexander Shopov <ash@kambanaria.org>
---
 builtin/rebase.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/rebase.c b/builtin/rebase.c
index 4084a6abb8..9c6d971515 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -746,7 +746,7 @@ static void parse_rebase_merges_value(struct rebase_options *options, const char
 	else if (!strcmp("rebase-cousins", value))
 		options->rebase_cousins = 1;
 	else
-		die(_("Unknown rebase-merges mode: %s"), value);
+		die(_("Unknown --rebase-merges mode: %s"), value);
 }

 static int rebase_config(const char *var, const char *value,
--
2.43.2
Alex Henrie· Feb 16, 2024, 19:05 UTC · re: Alexander Shopov · lore

Re: [Improvements on messages 1/5] rebase: trivial fix of error message

On Fri, Feb 16, 2024 at 3:16 AM Alexander Shopov <ash@kambanaria.org> wrote:
Show 18 quoted lines
>
> Mark --rebase-merges as option rather than variable name
>
> Signed-off-by: Alexander Shopov <ash@kambanaria.org>
> ---
>  builtin/rebase.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/builtin/rebase.c b/builtin/rebase.c
> index 4084a6abb8..9c6d971515 100644
> --- a/builtin/rebase.c
> +++ b/builtin/rebase.c
> @@ -746,7 +746,7 @@ static void parse_rebase_merges_value(struct rebase_options *options, const char
>         else if (!strcmp("rebase-cousins", value))
>                 options->rebase_cousins = 1;
>         else
> -               die(_("Unknown rebase-merges mode: %s"), value);
> +               die(_("Unknown --rebase-merges mode: %s"), value);

Hi Alexander! The other patches in this series look good to me, but I don't think this one is right. This error message could be about either the --rebase-merges command line option or the rebase.rebaseMerges config option. The word "rebase-merges" is intentionally ambiguous enough to cover both situations and was not intended to be left in English in translations.

-Alex
Alexander Shopov· Feb 16, 2024, 10:15 UTC · re: Alexander Shopov · lore

[Improvements on messages 2/5] transport-helper.c: trivial fix of error message

Mark --force as option rather than variable names
Signed-off-by: Alexander Shopov <ash@kambanaria.org>
---
 transport-helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/transport-helper.c b/transport-helper.c
index e34a8f47cf..7014b9ad70 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -1072,7 +1072,7 @@ static int push_refs_with_export(struct transport *transport,
 	set_common_push_options(transport, data->name, flags);
 	if (flags & TRANSPORT_PUSH_FORCE) {
 		if (set_helper_option(transport, "force", "true") != 0)
-			warning(_("helper %s does not support 'force'"), data->name);
+			warning(_("helper %s does not support '--force'"), data->name);
 	}

 	helper = get_helper(transport);
--
2.43.2
Alexander Shopov· Feb 16, 2024, 10:15 UTC · re: Alexander Shopov · lore

[Improvements on messages 3/5] builtin/remote.c: trivial fix of error message

Mark --mirror as option rather than command
Signed-off-by: Alexander Shopov <ash@kambanaria.org>
---
 builtin/remote.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/remote.c b/builtin/remote.c
index d91bbe728d..8412d12fa5 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -150,7 +150,7 @@ static int parse_mirror_opt(const struct option *opt, const char *arg, int not)
 	else if (!strcmp(arg, "push"))
 		*mirror = MIRROR_PUSH;
 	else
-		return error(_("unknown mirror argument: %s"), arg);
+		return error(_("unknown --mirror argument: %s"), arg);
 	return 0;
 }

--
2.43.2
Alexander Shopov· Feb 16, 2024, 10:15 UTC · re: Alexander Shopov · lore

[Improvements on messages 4/5] builtin/clone.c: trivial fix of message

bare in that context is an option, not purely an adjective Mark it properly

Signed-off-by: Alexander Shopov <ash@kambanaria.org>
---
 builtin/clone.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/clone.c b/builtin/clone.c
index 315befa133..f0261bbb01 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -115,7 +115,7 @@ static struct option builtin_clone_options[] = {
 	OPT_HIDDEN_BOOL(0, "naked", &option_bare,
 			N_("create a bare repository")),
 	OPT_BOOL(0, "mirror", &option_mirror,
-		 N_("create a mirror repository (implies bare)")),
+		 N_("create a mirror repository (implies --bare)")),
 	OPT_BOOL('l', "local", &option_local,
 		N_("to clone from a local repository")),
 	OPT_BOOL(0, "no-hardlinks", &option_no_hardlinks,
--
2.43.2
Alexander Shopov· Feb 16, 2024, 10:15 UTC · re: Alexander Shopov · lore

[Improvements on messages 5/5] revision.c: trivial fix to message

ancestry-path is an option, not a command - mark it as such. This brings it in sync with the rest of usages in the file

Signed-off-by: Alexander Shopov <ash@kambanaria.org>
---
 revision.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/revision.c b/revision.c
index 2424c9bd67..e29aa10781 100644
--- a/revision.c
+++ b/revision.c
@@ -2320,7 +2320,7 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
 	} else if (skip_prefix(arg, "--ancestry-path=", &optarg)) {
 		struct commit *c;
 		struct object_id oid;
-		const char *msg = _("could not get commit for ancestry-path argument %s");
+		const char *msg = _("could not get commit for --ancestry-path argument %s");

 		revs->ancestry_path = 1;
 		revs->simplify_history = 0;
--
2.43.2
Junio C Hamano· Feb 16, 2024, 18:43 UTC · re: Alexander Shopov · lore

Re: [Improvements on messages 0/5] Disambuiguate between options and commands

Alexander Shopov <ash@kambanaria.org> writes:
Show 8 quoted lines
> These are trivial fixes to messages.
> They make sure commands and options are markes as such.
> This will help translators and end users.
> This will also reduce the special cases Jiang Xin keeps
> for git-po-helper which will ease maintenance.
>
> I am basing these on maint but I have also checked that
> they ar still relevant by cherry picking on top of latest and next.
I've looked at all of them and they looked sensible.
The changes look like this:
	-	die(_("something option something: %s"), arg);
	+	die(_("something --option something: %s"), arg);

It is not a fault of this patch, but wasn't the concensus that the ideal form would be more like this:

		die(_("something %s something: %s"), "--option", arg);

in order to completely avoid tempting translators into touching "--option", IIRC?

These patches do not make things worse, so I am willing to say they are strict improvements and the series is a good first step if we wanted to follow through to eject option names out of translatable strings later.

Thanks.
Junio C Hamano· Mar 5, 2024, 22:05 UTC · re: Alexander Shopov · lore

Re: [Improvements on messages 0/5] Disambuiguate between options and commands

Alexander Shopov <ash@kambanaria.org> writes:
Show 8 quoted lines
> These are nice to be merged but this is not urgent.
>
> Alexander Shopov (5):
>   rebase: trivial fix of error message
>   transport-helper.c: trivial fix of error message
>   builtin/remote.c: trivial fix of error message
>   builtin/clone.c: trivial fix of message
>   revision.c: trivial fix to message

The first one got commented on with a suggestion to drop it; any comments on other patches, anybody?

If not, I'll drop the first patch and merge the remainder down to 'next'.

Thanks.

← back to recent threads