Re: [PATCH 3/7] shortlog: extract `--group` fragment for translation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 10 2022, Taylor Blau wrote:

> The subsequent commit will add another unhandled case in
> `read_from_stdin()` which will want to use the same message as with
> `--group=trailer`.
>
> Extract the "--group=trailer" part from this message so the same
> translation key can be used for both cases.
>
> Signed-off-by: Taylor Blau <me@xxxxxxxxxxxx>
> ---
>  builtin/shortlog.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/builtin/shortlog.c b/builtin/shortlog.c
> index 53c379a51d..051c97bd5a 100644
> --- a/builtin/shortlog.c
> +++ b/builtin/shortlog.c
> @@ -132,7 +132,7 @@ static void read_from_stdin(struct shortlog *log)
>  		match = committer_match;
>  		break;
>  	case SHORTLOG_GROUP_TRAILER:
> -		die(_("using --group=trailer with stdin is not supported"));
> +		die(_("using %s with stdin is not supported"), "--group=trailer");
>  	default:
>  		BUG("unhandled shortlog group");
>  	}

Rather than add another translation that you can use in 2x places here
(with 4/7) instead do:

diff --git a/builtin/shortlog.c b/builtin/shortlog.c
index 7a1e1fe7c0e..59aef24f637 100644
--- a/builtin/shortlog.c
+++ b/builtin/shortlog.c
@@ -132,7 +132,8 @@ static void read_from_stdin(struct shortlog *log)
 		match = committer_match;
 		break;
 	case SHORTLOG_GROUP_TRAILER:
-		die(_("using --group=trailer with stdin is not supported"));
+		die(_("options '%s' and '%s' cannot be used together"),
+		    "--group=<trailer>", "--stdin");
 	default:
 		BUG("unhandled shortlog group");
 	}

Which as you can see with "git grep 'cannot be used together'" we
already use in a lot of places.

We should probably extract this to a:

	die_opt_2_incompatible("--group=<trailer>", "--stdin");

But that can all be done in some hypothetical future, but for now the
status quo is that we know of these common strings, and copy/paste them
in various files.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux