diff mbox series

[01/11] worktree: combine two translatable messages

Message ID a113ed9a8449b57e2a88a24244f3e45b24a01862.1645379667.git.gitgitgadget@gmail.com (mailing list archive)
State Superseded
Headers show
Series Updates to worktree code and docs | expand

Commit Message

Derrick Stolee Feb. 20, 2022, 5:54 p.m. UTC
From: Derrick Stolee <derrickstolee@github.com>

These two messages differ only by the config key name, which should not
be translated. Extract those keys so the messages can be translated from
the same string.

Reported-by: Jean-Noël AVILA <jn.avila@free.fr>
Signed-off-by: Derrick Stolee <derrickstolee@github.com>
---
 builtin/worktree.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Junio C Hamano Feb. 20, 2022, 8:22 p.m. UTC | #1
"Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com> writes:

[jc: bogus CC addressses stripped and retyped; did something change
at GGG recently?]

> From: Derrick Stolee <derrickstolee@github.com>
>
> These two messages differ only by the config key name, which should not
> be translated. Extract those keys so the messages can be translated from
> the same string.

Makes sense.  Not just the reusing the same string is good, but this
will also make sure that translators have no chance of making a typo
on the variable names themselves, which is an added benefit.

> Reported-by: Jean-Noël AVILA <jn.avila@free.fr>
> Signed-off-by: Derrick Stolee <derrickstolee@github.com>
> ---
>  builtin/worktree.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/builtin/worktree.c b/builtin/worktree.c
> index c6eb636329a..7c272078dc9 100644
> --- a/builtin/worktree.c
> +++ b/builtin/worktree.c
> @@ -384,11 +384,13 @@ static int add_worktree(const char *path, const char *refname,
>  			    bare &&
>  			    git_config_set_multivar_in_file_gently(
>  					to_file, "core.bare", NULL, "true", 0))
> -				error(_("failed to unset 'core.bare' in '%s'"), to_file);
> +				error(_("failed to unset '%s' in '%s'"),
> +				      "core.bare", to_file);
>  			if (!git_configset_get_value(&cs, "core.worktree", &core_worktree) &&
>  			    git_config_set_in_file_gently(to_file,
>  							  "core.worktree", NULL))
> -				error(_("failed to unset 'core.worktree' in '%s'"), to_file);
> +				error(_("failed to unset '%s' in '%s'"),
> +				      "core.worktree", to_file);
>  
>  			git_configset_clear(&cs);
>  		}
Derrick Stolee Feb. 20, 2022, 8:29 p.m. UTC | #2
On 2/20/2022 3:22 PM, Junio C Hamano wrote:
> "Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com> writes:
> 
> [jc: bogus CC addressses stripped and retyped; did something change
> at GGG recently?]

This is actually my fault. I copy/pasted from the previous PR, but
that led to markdown-formatted links of some of the email addresses,
confusing GGG.

I fixed the description so a reroll shouldn't have this problem.

Thanks,
-Stolee
diff mbox series

Patch

diff --git a/builtin/worktree.c b/builtin/worktree.c
index c6eb636329a..7c272078dc9 100644
--- a/builtin/worktree.c
+++ b/builtin/worktree.c
@@ -384,11 +384,13 @@  static int add_worktree(const char *path, const char *refname,
 			    bare &&
 			    git_config_set_multivar_in_file_gently(
 					to_file, "core.bare", NULL, "true", 0))
-				error(_("failed to unset 'core.bare' in '%s'"), to_file);
+				error(_("failed to unset '%s' in '%s'"),
+				      "core.bare", to_file);
 			if (!git_configset_get_value(&cs, "core.worktree", &core_worktree) &&
 			    git_config_set_in_file_gently(to_file,
 							  "core.worktree", NULL))
-				error(_("failed to unset 'core.worktree' in '%s'"), to_file);
+				error(_("failed to unset '%s' in '%s'"),
+				      "core.worktree", to_file);
 
 			git_configset_clear(&cs);
 		}