From: Ævar Arnfjörð Bjarmason Date: Sun, 19 Sep 2010 16:53:39 +0000 (+0000) Subject: gettextize: git-commit "enter the commit message" message X-Git-Tag: ko-pu~10^2~113 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=6c3bfcff3f8e820957e90ff21f456b61164720cd;p=git.git gettextize: 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 --- diff --git a/builtin/commit.c b/builtin/commit.c index 469e4b9e3..5c01bf5f8 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -656,19 +656,19 @@ static int prepare_to_commit(const char *index_file, const char *prefix, git_path("MERGE_HEAD")); fprintf(fp, - "\n" - "# Please enter the commit message for your changes."); + _("\n" + "# Please enter the commit message for your changes.")); if (cleanup_mode == CLEANUP_ALL) fprintf(fp, - " Lines starting\n" + _(" Lines starting\n" "# with '#' will be ignored, and an empty" - " message aborts the commit.\n"); + " message aborts the commit.\n")); else /* CLEANUP_SPACE, that is. */ fprintf(fp, - " Lines starting\n" + _(" Lines starting\n" "# with '#' will be kept; you may remove them" " yourself if you want to.\n" - "# An empty message aborts the commit.\n"); + "# An empty message aborts the commit.\n")); if (only_include_assumed) fprintf(fp, "# %s\n", only_include_assumed); diff --git a/t/t7500-commit.sh b/t/t7500-commit.sh index aa9c577e9..24608a03b 100755 --- a/t/t7500-commit.sh +++ b/t/t7500-commit.sh @@ -59,7 +59,7 @@ test_expect_success 'adding comments to a template should not commit' ' ) ' -test_expect_success 'adding real content to a template should commit' ' +test_expect_success NO_GETTEXT_POISON 'adding real content to a template should commit' ' ( test_set_editor "$TEST_DIRECTORY"/t7500/add-content && git commit --template "$TEMPLATE" @@ -67,7 +67,7 @@ test_expect_success 'adding real content to a template should commit' ' commit_msg_is "template linecommit message" ' -test_expect_success '-t option should be short for --template' ' +test_expect_success NO_GETTEXT_POISON '-t option should be short for --template' ' echo "short template" > "$TEMPLATE" && echo "new content" >> foo && git add foo && @@ -78,7 +78,7 @@ test_expect_success '-t option should be short for --template' ' commit_msg_is "short templatecommit message" ' -test_expect_success 'config-specified template should commit' ' +test_expect_success NO_GETTEXT_POISON 'config-specified template should commit' ' echo "new template" > "$TEMPLATE" && git config commit.template "$TEMPLATE" && echo "more content" >> foo && diff --git a/t/t7502-commit.sh b/t/t7502-commit.sh index 4fede6bef..8409cba37 100755 --- a/t/t7502-commit.sh +++ b/t/t7502-commit.sh @@ -221,19 +221,21 @@ test_expect_success 'cleanup commit messages (strip,-F)' ' ' -echo "sample - -# Please enter the commit message for your changes. Lines starting -# with '#' will be ignored, and an empty message aborts the commit." >expect - test_expect_success 'cleanup commit messages (strip,-F,-e)' ' echo >>negative && { echo;echo sample;echo; } >text && git commit -e -F text -a && - head -n 4 .git/COMMIT_EDITMSG >actual && - test_cmp expect actual + head -n 4 .git/COMMIT_EDITMSG >actual +' + +echo "sample +# Please enter the commit message for your changes. Lines starting +# with '#' will be ignored, and an empty message aborts the commit." >expect + +test_expect_success NO_GETTEXT_POISON 'cleanup commit messages (strip,-F,-e): output' ' + test_cmp expect actual ' echo "# @@ -244,7 +246,10 @@ test_expect_success NO_GETTEXT_POISON 'author different from committer' ' echo >>negative && git commit -e -m "sample" - head -n 7 .git/COMMIT_EDITMSG >actual && + head -n 7 .git/COMMIT_EDITMSG >actual +' + +test_expect_success NO_GETTEXT_POISON 'author different from committer: output' ' test_cmp expect actual ' @@ -264,7 +269,10 @@ test_expect_success NO_GETTEXT_POISON 'committer is automatic' ' test_must_fail git commit -e -m "sample" ) && head -n 8 .git/COMMIT_EDITMSG | \ - sed "s/^# Committer: .*/# Committer:/" >actual && + sed "s/^# Committer: .*/# Committer:/" >actual +' + +test_expect_success NO_GETTEXT_POISON 'committer is automatic: output' ' test_cmp expect actual '