diff mbox series

[v3] l10n: reformat some localized strings for v2.23.0

Message ID 20190806171952.15588-1-jn.avila@free.fr (mailing list archive)
State New, archived
Headers show
Series [v3] l10n: reformat some localized strings for v2.23.0 | expand

Commit Message

Jean-Noël Avila Aug. 6, 2019, 5:19 p.m. UTC
Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
---
 builtin/checkout.c |  2 +-
 builtin/fetch.c    | 15 +++++++++++----
 2 files changed, 12 insertions(+), 5 deletions(-)

Comments

Junio C Hamano Aug. 6, 2019, 5:54 p.m. UTC | #1
Jean-Noël Avila <jn.avila@free.fr> writes:

> Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
> ---
>  builtin/checkout.c |  2 +-
>  builtin/fetch.c    | 15 +++++++++++----
>  2 files changed, 12 insertions(+), 5 deletions(-)

Thanks.  Folks, does this look sensible (it does to me)?

> diff --git a/builtin/checkout.c b/builtin/checkout.c
> index 91f8509f85..6123f732a2 100644
> --- a/builtin/checkout.c
> +++ b/builtin/checkout.c
> @@ -1769,7 +1769,7 @@ int cmd_restore(int argc, const char **argv, const char *prefix)
>  	struct option *options;
>  	struct option restore_options[] = {
>  		OPT_STRING('s', "source", &opts.from_treeish, "<tree-ish>",
> -			   N_("where the checkout from")),
> +			   N_("which tree-ish to checkout from")),
>  		OPT_BOOL('S', "staged", &opts.checkout_index,
>  			   N_("restore the index")),
>  		OPT_BOOL('W', "worktree", &opts.checkout_worktree,
> diff --git a/builtin/fetch.c b/builtin/fetch.c
> index 53ce99d2bb..c8bf4c651b 100644
> --- a/builtin/fetch.c
> +++ b/builtin/fetch.c
> @@ -850,6 +850,15 @@ static int iterate_ref_map(void *cb_data, struct object_id *oid)
>  	return 0;
>  }
>  
> +static char warn_show_forced_updates[] =
> +N_("Fetch normally indicates which branches had a forced update,\n"
> +   "but that check has been disabled. To re-enable, use '--show-forced-updates'\n"
> +   "flag or run 'git config fetch.showForcedUpdates true'.");
> +static char warn_time_show_forced_updates[] =
> +N_("It took %.2f seconds to check forced updates. You can use\n"
> +   "'--no-show-forced-updates' or run 'git config fetch.showForcedUpdates false'\n"
> +   " to avoid this check.\n");
> +
>  static int store_updated_refs(const char *raw_url, const char *remote_name,
>  			      int connectivity_checked, struct ref *ref_map)
>  {
> @@ -1005,12 +1014,10 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
>  
>  	if (advice_fetch_show_forced_updates) {
>  		if (!fetch_show_forced_updates) {
> -			warning(_("Fetch normally indicates which branches had a forced update, but that check has been disabled."));
> -			warning(_("To re-enable, use '--show-forced-updates' flag or run 'git config fetch.showForcedUpdates true'."));
> +                  warning(_(warn_show_forced_updates));
>  		} else if (forced_updates_ms > FORCED_UPDATES_DELAY_WARNING_IN_MS) {
> -			warning(_("It took %.2f seconds to check forced updates. You can use '--no-show-forced-updates'\n"),
> +			warning(_(warn_time_show_forced_updates),
>  				forced_updates_ms / 1000.0);
> -			warning(_("or run 'git config fetch.showForcedUpdates false' to avoid this check.\n"));
>  		}
>  	}
Jeff King Aug. 6, 2019, 6:10 p.m. UTC | #2
On Tue, Aug 06, 2019 at 10:54:47AM -0700, Junio C Hamano wrote:

> Jean-Noël Avila <jn.avila@free.fr> writes:
> 
> > Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
> > ---
> >  builtin/checkout.c |  2 +-
> >  builtin/fetch.c    | 15 +++++++++++----
> >  2 files changed, 12 insertions(+), 5 deletions(-)
> 
> Thanks.  Folks, does this look sensible (it does to me)?

Yes, modulo a funny indent in the final hunk (git-am will complain about
it).

I think we can take this as-is, but I did notice one thing when I
actually looked carefully at the surrounding code...

> >  	if (advice_fetch_show_forced_updates) {
> >  		if (!fetch_show_forced_updates) {
> > -			warning(_("Fetch normally indicates which branches had a forced update, but that check has been disabled."));
> > -			warning(_("To re-enable, use '--show-forced-updates' flag or run 'git config fetch.showForcedUpdates true'."));
> > +                  warning(_(warn_show_forced_updates));

This is controlled by advice.fetchShowForcedUpdates. Should these
warning() calls actually be advise()? In which case everything I said
about newlines and prefixes would then just work out, because advise()
does prefix each line independently. I'm happy to punt on that until
post-release, though, in the name of calming things down rather than
stirring them up. :)

-Peff
Junio C Hamano Aug. 6, 2019, 7:45 p.m. UTC | #3
Junio C Hamano <gitster@pobox.com> writes:

>> +static char warn_show_forced_updates[] =
>> +N_("Fetch normally indicates which branches had a forced update,\n"
>> +   "but that check has been disabled. To re-enable, use '--show-forced-updates'\n"
>> +   "flag or run 'git config fetch.showForcedUpdates true'.");
>> ...
>> +                  warning(_(warn_show_forced_updates));

This unfortunately triggers a false positive format-security
violation.   Turning it into "static const char var[]" would
squelch it, which I did for today's integration.
diff mbox series

Patch

diff --git a/builtin/checkout.c b/builtin/checkout.c
index 91f8509f85..6123f732a2 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -1769,7 +1769,7 @@  int cmd_restore(int argc, const char **argv, const char *prefix)
 	struct option *options;
 	struct option restore_options[] = {
 		OPT_STRING('s', "source", &opts.from_treeish, "<tree-ish>",
-			   N_("where the checkout from")),
+			   N_("which tree-ish to checkout from")),
 		OPT_BOOL('S', "staged", &opts.checkout_index,
 			   N_("restore the index")),
 		OPT_BOOL('W', "worktree", &opts.checkout_worktree,
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 53ce99d2bb..c8bf4c651b 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -850,6 +850,15 @@  static int iterate_ref_map(void *cb_data, struct object_id *oid)
 	return 0;
 }
 
+static char warn_show_forced_updates[] =
+N_("Fetch normally indicates which branches had a forced update,\n"
+   "but that check has been disabled. To re-enable, use '--show-forced-updates'\n"
+   "flag or run 'git config fetch.showForcedUpdates true'.");
+static char warn_time_show_forced_updates[] =
+N_("It took %.2f seconds to check forced updates. You can use\n"
+   "'--no-show-forced-updates' or run 'git config fetch.showForcedUpdates false'\n"
+   " to avoid this check.\n");
+
 static int store_updated_refs(const char *raw_url, const char *remote_name,
 			      int connectivity_checked, struct ref *ref_map)
 {
@@ -1005,12 +1014,10 @@  static int store_updated_refs(const char *raw_url, const char *remote_name,
 
 	if (advice_fetch_show_forced_updates) {
 		if (!fetch_show_forced_updates) {
-			warning(_("Fetch normally indicates which branches had a forced update, but that check has been disabled."));
-			warning(_("To re-enable, use '--show-forced-updates' flag or run 'git config fetch.showForcedUpdates true'."));
+                  warning(_(warn_show_forced_updates));
 		} else if (forced_updates_ms > FORCED_UPDATES_DELAY_WARNING_IN_MS) {
-			warning(_("It took %.2f seconds to check forced updates. You can use '--no-show-forced-updates'\n"),
+			warning(_(warn_time_show_forced_updates),
 				forced_updates_ms / 1000.0);
-			warning(_("or run 'git config fetch.showForcedUpdates false' to avoid this check.\n"));
 		}
 	}