@matheusbsbs / matheus-bagliano / commits / 0b430a17ae
Fork 0

i18n: git-commit "enter the commit message" message

Gettextize the "# Please enter the commit message for your changes." message. Several tests in t7500-commit.sh and t7502-commit.sh assume that this message starts with a newline. Change the tests to to skip under GETTEXT_POISON=YesPlease. These fail under GETTEXT_POISON=YesPlease because the poison editor message doesn't do the right thing with comments and line breaks, so these messages will be incorrectly broken up across lines. This test should not be skipped under a hypothetical future testing mode that tests Git under language locales, since those messages should all start with a newline like the original. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Feb 22, 2011 at 23:41 UTC 0b430a17ae88e56703270af7e29f845ffc7a891c
3 files changed +26 -18
builtin/commit.c
+5 -5
@@ -705,18 +705,18 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
705
706 fprintf(s->fp, "\n");
707 status_printf(s, GIT_COLOR_NORMAL,
708 - "Please enter the commit message for your changes.");
708 + _("Please enter the commit message for your changes."));
709 if (cleanup_mode == CLEANUP_ALL)
710 status_printf_more(s, GIT_COLOR_NORMAL,
711 - " Lines starting\n"
711 + _(" Lines starting\n"
712 "with '#' will be ignored, and an empty"
713 - " message aborts the commit.\n");
713 + " message aborts the commit.\n"));
714 else /* CLEANUP_SPACE, that is. */
715 status_printf_more(s, GIT_COLOR_NORMAL,
716 - " Lines starting\n"
716 + _(" Lines starting\n"
717 "with '#' will be kept; you may remove them"
718 " yourself if you want to.\n"
719 - "An empty message aborts the commit.\n");
719 + "An empty message aborts the commit.\n"));
720 if (only_include_assumed)
721 status_printf_ln(s, GIT_COLOR_NORMAL,
722 "%s", only_include_assumed);
t/t7500-commit.sh
+4 -4
@@ -64,7 +64,7 @@ test_expect_success 'adding comments to a template should not commit' '
64 )
65 '
66
67 -test_expect_success 'adding real content to a template should commit' '
67 +test_expect_success C_LOCALE_OUTPUT 'adding real content to a template should commit' '
68 (
69 test_set_editor "$TEST_DIRECTORY"/t7500/add-content &&
70 git commit --template "$TEMPLATE"
@@ -72,7 +72,7 @@ test_expect_success 'adding real content to a template should commit' '
72 commit_msg_is "template linecommit message"
73 '
74
75 -test_expect_success '-t option should be short for --template' '
75 +test_expect_success C_LOCALE_OUTPUT '-t option should be short for --template' '
76 echo "short template" > "$TEMPLATE" &&
77 echo "new content" >> foo &&
78 git add foo &&
@@ -83,7 +83,7 @@ test_expect_success '-t option should be short for --template' '
83 commit_msg_is "short templatecommit message"
84 '
85
86 -test_expect_success 'config-specified template should commit' '
86 +test_expect_success C_LOCALE_OUTPUT 'config-specified template should commit' '
87 echo "new template" > "$TEMPLATE" &&
88 git config commit.template "$TEMPLATE" &&
89 echo "more content" >> foo &&
@@ -282,7 +282,7 @@ test_expect_success 'commit --squash works with -c for same commit' '
282 commit_msg_is "squash! edited commit"
283 '
284
285 -test_expect_success 'commit --squash works with editor' '
285 +test_expect_success C_LOCALE_OUTPUT 'commit --squash works with editor' '
286 commit_for_rebase_autosquash_setup &&
287 test_set_editor "$TEST_DIRECTORY"/t7500/add-content &&
288 git commit --squash HEAD~1 &&
t/t7502-commit.sh
+17 -9
@@ -221,19 +221,21 @@ test_expect_success 'cleanup commit messages (strip,-F)' '
221
222 '
223
224 -echo "sample
225 -
226 -# Please enter the commit message for your changes. Lines starting
227 -# with '#' will be ignored, and an empty message aborts the commit." >expect
228 -
224 test_expect_success 'cleanup commit messages (strip,-F,-e)' '
225
226 echo >>negative &&
227 { echo;echo sample;echo; } >text &&
228 git commit -e -F text -a &&
234 - head -n 4 .git/COMMIT_EDITMSG >actual &&
235 - test_cmp expect actual
229 + head -n 4 .git/COMMIT_EDITMSG >actual
230 +'
231 +
232 +echo "sample
233
234 +# Please enter the commit message for your changes. Lines starting
235 +# with '#' will be ignored, and an empty message aborts the commit." >expect
236 +
237 +test_expect_success C_LOCALE_OUTPUT 'cleanup commit messages (strip,-F,-e): output' '
238 + test_cmp expect actual
239 '
240
241 echo "#
@@ -244,7 +246,10 @@ test_expect_success C_LOCALE_OUTPUT 'author different from committer' '
246
247 echo >>negative &&
248 git commit -e -m "sample"
247 - head -n 7 .git/COMMIT_EDITMSG >actual &&
249 + head -n 7 .git/COMMIT_EDITMSG >actual
250 +'
251 +
252 +test_expect_success C_LOCALE_OUTPUT 'author different from committer: output' '
253 test_cmp expect actual
254 '
255
@@ -264,7 +269,10 @@ test_expect_success C_LOCALE_OUTPUT 'committer is automatic' '
269 test_must_fail git commit -e -m "sample"
270 ) &&
271 head -n 8 .git/COMMIT_EDITMSG | \
267 - sed "s/^# Committer: .*/# Committer:/" >actual &&
272 + sed "s/^# Committer: .*/# Committer:/" >actual
273 +'
274 +
275 +test_expect_success C_LOCALE_OUTPUT 'committer is automatic: output' '
276 test_cmp expect actual
277 '
278