diff mbox series

[2/7] sequencer: factor GIT_AUTHOR_* from message strings

Message ID 8bdbb32f54421f99be55493257b31b203a11f202.1647813292.git.gitgitgadget@gmail.com (mailing list archive)
State Superseded
Headers show
Series More i18n fixes | expand

Commit Message

Bagas Sanjaya March 20, 2022, 9:54 p.m. UTC
From: Bagas Sanjaya <bagasdotme@gmail.com>

Factor messages containing GIT_AUTHOR_* variable.

Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
---
 sequencer.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Bagas Sanjaya March 21, 2022, 5:22 a.m. UTC | #1
On 21/03/22 04.54, Bagas Sanjaya via GitGitGadget wrote:
> From: Bagas Sanjaya <bagasdotme@gmail.com>
> 
> Factor messages containing GIT_AUTHOR_* variable.
> 
> Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
> ---
>   sequencer.c | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/sequencer.c b/sequencer.c
> index 84eed9e96bc..647f5efa656 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -848,17 +848,17 @@ int read_author_script(const char *path, char **name, char **email, char **date,
>   	for (i = 0; i < kv.nr; i++) {
>   		if (!strcmp(kv.items[i].string, "GIT_AUTHOR_NAME")) {
>   			if (name_i != -2)
> -				name_i = error(_("'GIT_AUTHOR_NAME' already given"));
> +				name_i = error(_("'%s' already given"), "GIT_AUTHOR_NAME");
>   			else
>   				name_i = i;
>   		} else if (!strcmp(kv.items[i].string, "GIT_AUTHOR_EMAIL")) {
>   			if (email_i != -2)
> -				email_i = error(_("'GIT_AUTHOR_EMAIL' already given"));
> +				email_i = error(_("'%s' already given"), "GIT_AUTHOR_EMAIL");
>   			else
>   				email_i = i;
>   		} else if (!strcmp(kv.items[i].string, "GIT_AUTHOR_DATE")) {
>   			if (date_i != -2)
> -				date_i = error(_("'GIT_AUTHOR_DATE' already given"));
> +				date_i = error(_("'%s' already given"), "GIT_AUTHOR_DATE");
>   			else
>   				date_i = i;
>   		} else {
> @@ -867,11 +867,11 @@ int read_author_script(const char *path, char **name, char **email, char **date,
>   		}
>   	}
>   	if (name_i == -2)
> -		error(_("missing 'GIT_AUTHOR_NAME'"));
> +		error(_("missing '%s'"), "GIT_AUTHOR_NAME");
>   	if (email_i == -2)
> -		error(_("missing 'GIT_AUTHOR_EMAIL'"));
> +		error(_("missing '%s'"), "GIT_AUTHOR_EMAIL");
>   	if (date_i == -2)
> -		error(_("missing 'GIT_AUTHOR_DATE'"));
> +		error(_("missing '%s'"), "GIT_AUTHOR_DATE");
>   	if (date_i < 0 || email_i < 0 || date_i < 0 || err)
>   		goto finish;
>   	*name = kv.items[name_i].util;

Looks OK. Thanks for picking this up.

Acked-by: Bagas Sanjaya <bagasdotme@gmail.com>
diff mbox series

Patch

diff --git a/sequencer.c b/sequencer.c
index 84eed9e96bc..647f5efa656 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -848,17 +848,17 @@  int read_author_script(const char *path, char **name, char **email, char **date,
 	for (i = 0; i < kv.nr; i++) {
 		if (!strcmp(kv.items[i].string, "GIT_AUTHOR_NAME")) {
 			if (name_i != -2)
-				name_i = error(_("'GIT_AUTHOR_NAME' already given"));
+				name_i = error(_("'%s' already given"), "GIT_AUTHOR_NAME");
 			else
 				name_i = i;
 		} else if (!strcmp(kv.items[i].string, "GIT_AUTHOR_EMAIL")) {
 			if (email_i != -2)
-				email_i = error(_("'GIT_AUTHOR_EMAIL' already given"));
+				email_i = error(_("'%s' already given"), "GIT_AUTHOR_EMAIL");
 			else
 				email_i = i;
 		} else if (!strcmp(kv.items[i].string, "GIT_AUTHOR_DATE")) {
 			if (date_i != -2)
-				date_i = error(_("'GIT_AUTHOR_DATE' already given"));
+				date_i = error(_("'%s' already given"), "GIT_AUTHOR_DATE");
 			else
 				date_i = i;
 		} else {
@@ -867,11 +867,11 @@  int read_author_script(const char *path, char **name, char **email, char **date,
 		}
 	}
 	if (name_i == -2)
-		error(_("missing 'GIT_AUTHOR_NAME'"));
+		error(_("missing '%s'"), "GIT_AUTHOR_NAME");
 	if (email_i == -2)
-		error(_("missing 'GIT_AUTHOR_EMAIL'"));
+		error(_("missing '%s'"), "GIT_AUTHOR_EMAIL");
 	if (date_i == -2)
-		error(_("missing 'GIT_AUTHOR_DATE'"));
+		error(_("missing '%s'"), "GIT_AUTHOR_DATE");
 	if (date_i < 0 || email_i < 0 || date_i < 0 || err)
 		goto finish;
 	*name = kv.items[name_i].util;