* [PATCH 1/6] i18n: commit: mark message for translation
@ 2016-09-19 13:08 Vasco Almeida
2016-09-19 13:08 ` [PATCH 2/6] i18n: connect: mark die messages " Vasco Almeida
` (5 more replies)
0 siblings, 6 replies; 11+ messages in thread
From: Vasco Almeida @ 2016-09-19 13:08 UTC (permalink / raw)
To: git
Cc: Vasco Almeida, Jiang Xin, Ævar Arnfjörð Bjarmason,
Jean-Noël AVILA
Mark message commit_utf8_warn for translation.
Update tests to reflect changes.
Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
---
commit.c | 8 ++++----
t/t3900-i18n-commit.sh | 8 ++++----
t/t3901-i18n-patch.sh | 2 +-
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/commit.c b/commit.c
index ba6dee3..8eb1707 100644
--- a/commit.c
+++ b/commit.c
@@ -1511,9 +1511,9 @@ static int verify_utf8(struct strbuf *buf)
}
static const char commit_utf8_warn[] =
-"Warning: commit message did not conform to UTF-8.\n"
-"You may want to amend it after fixing the message, or set the config\n"
-"variable i18n.commitencoding to the encoding your project uses.\n";
+N_("Warning: commit message did not conform to UTF-8.\n"
+ "You may want to amend it after fixing the message, or set the config\n"
+ "variable i18n.commitencoding to the encoding your project uses.\n");
int commit_tree_extended(const char *msg, size_t msg_len,
const unsigned char *tree,
@@ -1566,7 +1566,7 @@ int commit_tree_extended(const char *msg, size_t msg_len,
/* And check the encoding */
if (encoding_is_utf8 && !verify_utf8(&buffer))
- fprintf(stderr, commit_utf8_warn);
+ fprintf(stderr, _(commit_utf8_warn));
if (sign_commit && do_sign_commit(&buffer, sign_commit))
return -1;
diff --git a/t/t3900-i18n-commit.sh b/t/t3900-i18n-commit.sh
index 4bf1dbe..3b94283 100755
--- a/t/t3900-i18n-commit.sh
+++ b/t/t3900-i18n-commit.sh
@@ -45,7 +45,7 @@ test_expect_success 'UTF-8 invalid characters refused' '
printf "Commit message\n\nInvalid surrogate:\355\240\200\n" \
>"$HOME/invalid" &&
git commit -a -F "$HOME/invalid" 2>"$HOME"/stderr &&
- grep "did not conform" "$HOME"/stderr
+ test_i18ngrep "did not conform" "$HOME"/stderr
'
test_expect_success 'UTF-8 overlong sequences rejected' '
@@ -55,7 +55,7 @@ test_expect_success 'UTF-8 overlong sequences rejected' '
printf "\340\202\251ommit message\n\nThis is not a space:\300\240\n" \
>"$HOME/invalid" &&
git commit -a -F "$HOME/invalid" 2>"$HOME"/stderr &&
- grep "did not conform" "$HOME"/stderr
+ test_i18ngrep "did not conform" "$HOME"/stderr
'
test_expect_success 'UTF-8 non-characters refused' '
@@ -64,7 +64,7 @@ test_expect_success 'UTF-8 non-characters refused' '
printf "Commit message\n\nNon-character:\364\217\277\276\n" \
>"$HOME/invalid" &&
git commit -a -F "$HOME/invalid" 2>"$HOME"/stderr &&
- grep "did not conform" "$HOME"/stderr
+ test_i18ngrep "did not conform" "$HOME"/stderr
'
test_expect_success 'UTF-8 non-characters refused' '
@@ -73,7 +73,7 @@ test_expect_success 'UTF-8 non-characters refused' '
printf "Commit message\n\nNon-character:\357\267\220\n" \
>"$HOME/invalid" &&
git commit -a -F "$HOME/invalid" 2>"$HOME"/stderr &&
- grep "did not conform" "$HOME"/stderr
+ test_i18ngrep "did not conform" "$HOME"/stderr
'
for H in ISO8859-1 eucJP ISO-2022-JP
diff --git a/t/t3901-i18n-patch.sh b/t/t3901-i18n-patch.sh
index 509084e..f663d56 100755
--- a/t/t3901-i18n-patch.sh
+++ b/t/t3901-i18n-patch.sh
@@ -295,7 +295,7 @@ test_expect_success 'am --no-utf8 (U/L)' '
# commit-tree will warn that the commit message does not contain valid UTF-8
# as mailinfo did not convert it
- grep "did not conform" err &&
+ test_i18ngrep "did not conform" err &&
check_encoding 2
'
--
2.7.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/6] i18n: connect: mark die messages for translation
2016-09-19 13:08 [PATCH 1/6] i18n: commit: mark message for translation Vasco Almeida
@ 2016-09-19 13:08 ` Vasco Almeida
2016-09-19 13:08 ` [PATCH 3/6] i18n: diff: mark die errors " Vasco Almeida
` (4 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Vasco Almeida @ 2016-09-19 13:08 UTC (permalink / raw)
To: git
Cc: Vasco Almeida, Jiang Xin, Ævar Arnfjörð Bjarmason,
Jean-Noël AVILA
Mark messages passed to die() in die_initial_contact().
Update test to reflect changes.
Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
---
connect.c | 8 ++++----
t/t5512-ls-remote.sh | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/connect.c b/connect.c
index 722dc3f..06bff0b 100644
--- a/connect.c
+++ b/connect.c
@@ -46,11 +46,11 @@ int check_ref_type(const struct ref *ref, int flags)
static void die_initial_contact(int got_at_least_one_head)
{
if (got_at_least_one_head)
- die("The remote end hung up upon initial contact");
+ die(_("The remote end hung up upon initial contact"));
else
- die("Could not read from remote repository.\n\n"
- "Please make sure you have the correct access rights\n"
- "and the repository exists.");
+ die(_("Could not read from remote repository.\n\n"
+ "Please make sure you have the correct access rights\n"
+ "and the repository exists."));
}
static void parse_one_symref_info(struct string_list *symref, const char *val, int len)
diff --git a/t/t5512-ls-remote.sh b/t/t5512-ls-remote.sh
index 819b9dd..c23434b 100755
--- a/t/t5512-ls-remote.sh
+++ b/t/t5512-ls-remote.sh
@@ -99,7 +99,7 @@ test_expect_success 'confuses pattern as remote when no remote specified' '
# We could just as easily have used "master"; the "*" emphasizes its
# role as a pattern.
test_must_fail git ls-remote refs*master >actual 2>&1 &&
- test_cmp exp actual
+ test_i18ncmp exp actual
'
test_expect_success 'die with non-2 for wrong repository even with --exit-code' '
--
2.7.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 3/6] i18n: diff: mark die errors for translation
2016-09-19 13:08 [PATCH 1/6] i18n: commit: mark message for translation Vasco Almeida
2016-09-19 13:08 ` [PATCH 2/6] i18n: connect: mark die messages " Vasco Almeida
@ 2016-09-19 13:08 ` Vasco Almeida
2016-09-19 13:08 ` [PATCH 4/6] i18n: ident: mark hint " Vasco Almeida
` (3 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Vasco Almeida @ 2016-09-19 13:08 UTC (permalink / raw)
To: git
Cc: Vasco Almeida, Jiang Xin, Ævar Arnfjörð Bjarmason,
Jean-Noël AVILA
Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
---
diff.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/diff.c b/diff.c
index b4310f8..d82ad79 100644
--- a/diff.c
+++ b/diff.c
@@ -3325,7 +3325,7 @@ void diff_setup_done(struct diff_options *options)
if (options->output_format & DIFF_FORMAT_NO_OUTPUT)
count++;
if (count > 1)
- die("--name-only, --name-status, --check and -s are mutually exclusive");
+ die(_("--name-only, --name-status, --check and -s are mutually exclusive"));
/*
* Most of the time we can say "there are changes"
@@ -3521,7 +3521,7 @@ static int stat_opt(struct diff_options *options, const char **av)
if (*arg == '=')
width = strtoul(arg + 1, &end, 10);
else if (!*arg && !av[1])
- die("Option '--stat-width' requires a value");
+ die(_("Option '--stat-width' requires a value"));
else if (!*arg) {
width = strtoul(av[1], &end, 10);
argcount = 2;
@@ -3530,7 +3530,7 @@ static int stat_opt(struct diff_options *options, const char **av)
if (*arg == '=')
name_width = strtoul(arg + 1, &end, 10);
else if (!*arg && !av[1])
- die("Option '--stat-name-width' requires a value");
+ die(_("Option '--stat-name-width' requires a value"));
else if (!*arg) {
name_width = strtoul(av[1], &end, 10);
argcount = 2;
@@ -3539,7 +3539,7 @@ static int stat_opt(struct diff_options *options, const char **av)
if (*arg == '=')
graph_width = strtoul(arg + 1, &end, 10);
else if (!*arg && !av[1])
- die("Option '--stat-graph-width' requires a value");
+ die(_("Option '--stat-graph-width' requires a value"));
else if (!*arg) {
graph_width = strtoul(av[1], &end, 10);
argcount = 2;
@@ -3548,7 +3548,7 @@ static int stat_opt(struct diff_options *options, const char **av)
if (*arg == '=')
count = strtoul(arg + 1, &end, 10);
else if (!*arg && !av[1])
- die("Option '--stat-count' requires a value");
+ die(_("Option '--stat-count' requires a value"));
else if (!*arg) {
count = strtoul(av[1], &end, 10);
argcount = 2;
--
2.7.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 4/6] i18n: ident: mark hint for translation
2016-09-19 13:08 [PATCH 1/6] i18n: commit: mark message for translation Vasco Almeida
2016-09-19 13:08 ` [PATCH 2/6] i18n: connect: mark die messages " Vasco Almeida
2016-09-19 13:08 ` [PATCH 3/6] i18n: diff: mark die errors " Vasco Almeida
@ 2016-09-19 13:08 ` Vasco Almeida
2016-09-19 13:08 ` [PATCH 5/6] i18n: notes-merge: mark die messages " Vasco Almeida
` (2 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Vasco Almeida @ 2016-09-19 13:08 UTC (permalink / raw)
To: git
Cc: Vasco Almeida, Jiang Xin, Ævar Arnfjörð Bjarmason,
Jean-Noël AVILA
Mark env_hint for translation.
Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
---
ident.c | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/ident.c b/ident.c
index e20a772..92c3cca 100644
--- a/ident.c
+++ b/ident.c
@@ -331,17 +331,17 @@ int split_ident_line(struct ident_split *split, const char *line, int len)
}
static const char *env_hint =
-"\n"
-"*** Please tell me who you are.\n"
-"\n"
-"Run\n"
-"\n"
-" git config --global user.email \"you@example.com\"\n"
-" git config --global user.name \"Your Name\"\n"
-"\n"
-"to set your account\'s default identity.\n"
-"Omit --global to set the identity only in this repository.\n"
-"\n";
+N_("\n"
+ "*** Please tell me who you are.\n"
+ "\n"
+ "Run\n"
+ "\n"
+ " git config --global user.email \"you@example.com\"\n"
+ " git config --global user.name \"Your Name\"\n"
+ "\n"
+ "to set your account\'s default identity.\n"
+ "Omit --global to set the identity only in this repository.\n"
+ "\n");
const char *fmt_ident(const char *name, const char *email,
const char *date_str, int flag)
@@ -356,13 +356,13 @@ const char *fmt_ident(const char *name, const char *email,
if (!name) {
if (strict && ident_use_config_only
&& !(ident_config_given & IDENT_NAME_GIVEN)) {
- fputs(env_hint, stderr);
+ fputs(_(env_hint), stderr);
die("no name was given and auto-detection is disabled");
}
name = ident_default_name();
using_default = 1;
if (strict && default_name_is_bogus) {
- fputs(env_hint, stderr);
+ fputs(_(env_hint), stderr);
die("unable to auto-detect name (got '%s')", name);
}
}
@@ -370,7 +370,7 @@ const char *fmt_ident(const char *name, const char *email,
struct passwd *pw;
if (strict) {
if (using_default)
- fputs(env_hint, stderr);
+ fputs(_(env_hint), stderr);
die("empty ident name (for <%s>) not allowed", email);
}
pw = xgetpwuid_self(NULL);
@@ -381,12 +381,12 @@ const char *fmt_ident(const char *name, const char *email,
if (!email) {
if (strict && ident_use_config_only
&& !(ident_config_given & IDENT_MAIL_GIVEN)) {
- fputs(env_hint, stderr);
+ fputs(_(env_hint), stderr);
die("no email was given and auto-detection is disabled");
}
email = ident_default_email();
if (strict && default_email_is_bogus) {
- fputs(env_hint, stderr);
+ fputs(_(env_hint), stderr);
die("unable to auto-detect email address (got '%s')", email);
}
}
--
2.7.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 5/6] i18n: notes-merge: mark die messages for translation
2016-09-19 13:08 [PATCH 1/6] i18n: commit: mark message for translation Vasco Almeida
` (2 preceding siblings ...)
2016-09-19 13:08 ` [PATCH 4/6] i18n: ident: mark hint " Vasco Almeida
@ 2016-09-19 13:08 ` Vasco Almeida
2016-09-19 13:08 ` [PATCH 6/6] i18n: stash: mark " Vasco Almeida
2016-09-19 17:54 ` [PATCH 1/6] i18n: commit: mark message " Junio C Hamano
5 siblings, 0 replies; 11+ messages in thread
From: Vasco Almeida @ 2016-09-19 13:08 UTC (permalink / raw)
To: git
Cc: Vasco Almeida, Jiang Xin, Ævar Arnfjörð Bjarmason,
Jean-Noël AVILA
Update test to reflect changes.
Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
---
notes-merge.c | 8 ++++----
t/t3310-notes-merge-manual-resolve.sh | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/notes-merge.c b/notes-merge.c
index 97fc42f..3bbeb86 100644
--- a/notes-merge.c
+++ b/notes-merge.c
@@ -269,15 +269,15 @@ static void check_notes_merge_worktree(struct notes_merge_options *o)
if (file_exists(git_path(NOTES_MERGE_WORKTREE)) &&
!is_empty_dir(git_path(NOTES_MERGE_WORKTREE))) {
if (advice_resolve_conflict)
- die("You have not concluded your previous "
+ die(_("You have not concluded your previous "
"notes merge (%s exists).\nPlease, use "
"'git notes merge --commit' or 'git notes "
"merge --abort' to commit/abort the "
"previous merge before you start a new "
- "notes merge.", git_path("NOTES_MERGE_*"));
+ "notes merge."), git_path("NOTES_MERGE_*"));
else
- die("You have not concluded your notes merge "
- "(%s exists).", git_path("NOTES_MERGE_*"));
+ die(_("You have not concluded your notes merge "
+ "(%s exists)."), git_path("NOTES_MERGE_*"));
}
if (safe_create_leading_directories_const(git_path(
diff --git a/t/t3310-notes-merge-manual-resolve.sh b/t/t3310-notes-merge-manual-resolve.sh
index 6967436..baef2d6 100755
--- a/t/t3310-notes-merge-manual-resolve.sh
+++ b/t/t3310-notes-merge-manual-resolve.sh
@@ -225,7 +225,7 @@ test_expect_success 'cannot do merge w/conflicts when previous merge is unfinish
test -d .git/NOTES_MERGE_WORKTREE &&
test_must_fail git notes merge z >output 2>&1 &&
# Output should indicate what is wrong
- grep -q "\\.git/NOTES_MERGE_\\* exists" output
+ test_i18ngrep -q "\\.git/NOTES_MERGE_\\* exists" output
'
# Setup non-conflicting merge between x and new notes ref w
--
2.7.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 6/6] i18n: stash: mark messages for translation
2016-09-19 13:08 [PATCH 1/6] i18n: commit: mark message for translation Vasco Almeida
` (3 preceding siblings ...)
2016-09-19 13:08 ` [PATCH 5/6] i18n: notes-merge: mark die messages " Vasco Almeida
@ 2016-09-19 13:08 ` Vasco Almeida
2016-09-19 17:54 ` [PATCH 1/6] i18n: commit: mark message " Junio C Hamano
5 siblings, 0 replies; 11+ messages in thread
From: Vasco Almeida @ 2016-09-19 13:08 UTC (permalink / raw)
To: git
Cc: Vasco Almeida, Jiang Xin, Ævar Arnfjörð Bjarmason,
Jean-Noël AVILA
Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
---
git-stash.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/git-stash.sh b/git-stash.sh
index 826af18..90d63f2 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -100,7 +100,7 @@ create_stash () {
u_tree=$(git write-tree) &&
printf 'untracked files on %s\n' "$msg" | git commit-tree $u_tree &&
rm -f "$TMPindex"
- ) ) || die "Cannot save the untracked files"
+ ) ) || die "$(gettext "Cannot save the untracked files")"
untracked_commit_option="-p $u_commit";
else
@@ -248,7 +248,7 @@ save_stash () {
if test -n "$patch_mode" && test -n "$untracked"
then
- die "Can't use --patch and --include-untracked or --all at the same time"
+ die "$(gettext "Can't use --patch and --include-untracked or --all at the same time")"
fi
stash_msg="$*"
@@ -494,7 +494,7 @@ apply_stash () {
GIT_INDEX_FILE="$TMPindex" git-read-tree "$u_tree" &&
GIT_INDEX_FILE="$TMPindex" git checkout-index --all &&
rm -f "$TMPindex" ||
- die 'Could not restore untracked files from stash'
+ die "$(gettext "Could not restore untracked files from stash")"
fi
eval "
--
2.7.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 1/6] i18n: commit: mark message for translation
2016-09-19 13:08 [PATCH 1/6] i18n: commit: mark message for translation Vasco Almeida
` (4 preceding siblings ...)
2016-09-19 13:08 ` [PATCH 6/6] i18n: stash: mark " Vasco Almeida
@ 2016-09-19 17:54 ` Junio C Hamano
2016-09-19 20:34 ` Jean-Noël AVILA
5 siblings, 1 reply; 11+ messages in thread
From: Junio C Hamano @ 2016-09-19 17:54 UTC (permalink / raw)
To: Vasco Almeida
Cc: git, Jiang Xin, Ævar Arnfjörð Bjarmason,
Jean-Noël AVILA
I am responding to 1/6, as the series lacked a cover letter, but all
of them looked good.
Thanks.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/6] i18n: commit: mark message for translation
2016-09-19 17:54 ` [PATCH 1/6] i18n: commit: mark message " Junio C Hamano
@ 2016-09-19 20:34 ` Jean-Noël AVILA
2016-09-19 21:08 ` Junio C Hamano
0 siblings, 1 reply; 11+ messages in thread
From: Jean-Noël AVILA @ 2016-09-19 20:34 UTC (permalink / raw)
To: Junio C Hamano
Cc: Vasco Almeida, git, Jiang Xin, Ævar Arnfjörð Bjarmason
On lundi 19 septembre 2016 10:54:37 CEST Junio C Hamano wrote:
> I am responding to 1/6, as the series lacked a cover letter, but all
> of them looked good.
>
> Thanks.
Maybe 3/6 would have benefited from some code factorization. But that's ok for
a few more sentences.
Thanks.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/6] i18n: commit: mark message for translation
2016-09-19 20:34 ` Jean-Noël AVILA
@ 2016-09-19 21:08 ` Junio C Hamano
2016-09-20 19:04 ` Jean-Noël AVILA
0 siblings, 1 reply; 11+ messages in thread
From: Junio C Hamano @ 2016-09-19 21:08 UTC (permalink / raw)
To: Jean-Noël AVILA
Cc: Vasco Almeida, git, Jiang Xin, Ævar Arnfjörð Bjarmason
Jean-Noël AVILA <jn.avila@free.fr> writes:
> Maybe 3/6 would have benefited from some code factorization. But that's ok for
> a few more sentences.
Ah, let me see I understood what you mean. Adding something like
this
static NORETURN void die_want_option(const char *option_name)
{
die(_("option '%s' requires a value"), option_name);
}
and have many of the callers of die() call it would reduce the
number of strings that translators would need to touch.
I agree, but I think we can do that in a later follow-up.
Thanks.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/6] i18n: commit: mark message for translation
2016-09-19 21:08 ` Junio C Hamano
@ 2016-09-20 19:04 ` Jean-Noël AVILA
2016-09-21 17:17 ` Junio C Hamano
0 siblings, 1 reply; 11+ messages in thread
From: Jean-Noël AVILA @ 2016-09-20 19:04 UTC (permalink / raw)
To: Junio C Hamano
Cc: Vasco Almeida, git, Jiang Xin, Ævar Arnfjörð Bjarmason
Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
---
Instead of distillating change requests, I'd better do it by myself. Here is the reworked version of the patch.
diff.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/diff.c b/diff.c
index c6da383..494f723 100644
--- a/diff.c
+++ b/diff.c
@@ -55,6 +55,11 @@ static char diff_colors[][COLOR_MAXLEN] = {
GIT_COLOR_NORMAL, /* FUNCINFO */
};
+static NORETURN void die_want_option(const char *option_name)
+{
+ die(_("option '%s' requires a value"), option_name);
+}
+
static int parse_diff_color_slot(const char *var)
{
if (!strcasecmp(var, "context") || !strcasecmp(var, "plain"))
@@ -3325,7 +3330,7 @@ void diff_setup_done(struct diff_options *options)
if (options->output_format & DIFF_FORMAT_NO_OUTPUT)
count++;
if (count > 1)
- die("--name-only, --name-status, --check and -s are mutually exclusive");
+ die(_("--name-only, --name-status, --check and -s are mutually exclusive"));
/*
* Most of the time we can say "there are changes"
@@ -3521,7 +3526,7 @@ static int stat_opt(struct diff_options *options, const char **av)
if (*arg == '=')
width = strtoul(arg + 1, &end, 10);
else if (!*arg && !av[1])
- die("Option '--stat-width' requires a value");
+ die_want_option("--stat-width");
else if (!*arg) {
width = strtoul(av[1], &end, 10);
argcount = 2;
@@ -3530,7 +3535,7 @@ static int stat_opt(struct diff_options *options, const char **av)
if (*arg == '=')
name_width = strtoul(arg + 1, &end, 10);
else if (!*arg && !av[1])
- die("Option '--stat-name-width' requires a value");
+ die_want_option("--stat-name-width");
else if (!*arg) {
name_width = strtoul(av[1], &end, 10);
argcount = 2;
@@ -3539,7 +3544,7 @@ static int stat_opt(struct diff_options *options, const char **av)
if (*arg == '=')
graph_width = strtoul(arg + 1, &end, 10);
else if (!*arg && !av[1])
- die("Option '--stat-graph-width' requires a value");
+ die_want_option("--stat-graph-width");
else if (!*arg) {
graph_width = strtoul(av[1], &end, 10);
argcount = 2;
@@ -3548,7 +3553,7 @@ static int stat_opt(struct diff_options *options, const char **av)
if (*arg == '=')
count = strtoul(arg + 1, &end, 10);
else if (!*arg && !av[1])
- die("Option '--stat-count' requires a value");
+ die_want_option("--stat-count");
else if (!*arg) {
count = strtoul(av[1], &end, 10);
argcount = 2;
--
2.10.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 1/6] i18n: commit: mark message for translation
2016-09-20 19:04 ` Jean-Noël AVILA
@ 2016-09-21 17:17 ` Junio C Hamano
0 siblings, 0 replies; 11+ messages in thread
From: Junio C Hamano @ 2016-09-21 17:17 UTC (permalink / raw)
To: Jean-Noël AVILA
Cc: Vasco Almeida, git, Jiang Xin, Ævar Arnfjörð Bjarmason
Jean-Noël AVILA <jn.avila@free.fr> writes:
> Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
> Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
> ---
>
> Instead of distillating change requests, I'd better do it by
> myself. Here is the reworked version of the patch.
>
It would have helped if you had an in-body header to retitle this
patch for 3/6, instead of leaving it as 1/6 for "commit" X-<.
Will tweak and fit it in. Thanks.
> diff.c | 15 ++++++++++-----
> 1 file changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/diff.c b/diff.c
> index c6da383..494f723 100644
> --- a/diff.c
> +++ b/diff.c
> @@ -55,6 +55,11 @@ static char diff_colors[][COLOR_MAXLEN] = {
> GIT_COLOR_NORMAL, /* FUNCINFO */
> };
>
> +static NORETURN void die_want_option(const char *option_name)
> +{
> + die(_("option '%s' requires a value"), option_name);
> +}
> +
> static int parse_diff_color_slot(const char *var)
> {
> if (!strcasecmp(var, "context") || !strcasecmp(var, "plain"))
> @@ -3325,7 +3330,7 @@ void diff_setup_done(struct diff_options *options)
> if (options->output_format & DIFF_FORMAT_NO_OUTPUT)
> count++;
> if (count > 1)
> - die("--name-only, --name-status, --check and -s are mutually exclusive");
> + die(_("--name-only, --name-status, --check and -s are mutually exclusive"));
>
> /*
> * Most of the time we can say "there are changes"
> @@ -3521,7 +3526,7 @@ static int stat_opt(struct diff_options *options, const char **av)
> if (*arg == '=')
> width = strtoul(arg + 1, &end, 10);
> else if (!*arg && !av[1])
> - die("Option '--stat-width' requires a value");
> + die_want_option("--stat-width");
> else if (!*arg) {
> width = strtoul(av[1], &end, 10);
> argcount = 2;
> @@ -3530,7 +3535,7 @@ static int stat_opt(struct diff_options *options, const char **av)
> if (*arg == '=')
> name_width = strtoul(arg + 1, &end, 10);
> else if (!*arg && !av[1])
> - die("Option '--stat-name-width' requires a value");
> + die_want_option("--stat-name-width");
> else if (!*arg) {
> name_width = strtoul(av[1], &end, 10);
> argcount = 2;
> @@ -3539,7 +3544,7 @@ static int stat_opt(struct diff_options *options, const char **av)
> if (*arg == '=')
> graph_width = strtoul(arg + 1, &end, 10);
> else if (!*arg && !av[1])
> - die("Option '--stat-graph-width' requires a value");
> + die_want_option("--stat-graph-width");
> else if (!*arg) {
> graph_width = strtoul(av[1], &end, 10);
> argcount = 2;
> @@ -3548,7 +3553,7 @@ static int stat_opt(struct diff_options *options, const char **av)
> if (*arg == '=')
> count = strtoul(arg + 1, &end, 10);
> else if (!*arg && !av[1])
> - die("Option '--stat-count' requires a value");
> + die_want_option("--stat-count");
> else if (!*arg) {
> count = strtoul(av[1], &end, 10);
> argcount = 2;
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2016-09-21 17:18 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-19 13:08 [PATCH 1/6] i18n: commit: mark message for translation Vasco Almeida
2016-09-19 13:08 ` [PATCH 2/6] i18n: connect: mark die messages " Vasco Almeida
2016-09-19 13:08 ` [PATCH 3/6] i18n: diff: mark die errors " Vasco Almeida
2016-09-19 13:08 ` [PATCH 4/6] i18n: ident: mark hint " Vasco Almeida
2016-09-19 13:08 ` [PATCH 5/6] i18n: notes-merge: mark die messages " Vasco Almeida
2016-09-19 13:08 ` [PATCH 6/6] i18n: stash: mark " Vasco Almeida
2016-09-19 17:54 ` [PATCH 1/6] i18n: commit: mark message " Junio C Hamano
2016-09-19 20:34 ` Jean-Noël AVILA
2016-09-19 21:08 ` Junio C Hamano
2016-09-20 19:04 ` Jean-Noël AVILA
2016-09-21 17:17 ` Junio C Hamano
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.