Code

Merge branch 'gr/cvsimport-alternative-cvspass-location' into maint
[git.git] / t / t7502-commit.sh
index ac2e187a5720d1ff947e58073dd6cc403ef40d5d..cfb569eaba657501cf0361bee8c3f7c172ed1c06 100755 (executable)
@@ -22,7 +22,10 @@ check_summary_oneline() {
        SUMMARY_POSTFIX="$(git log -1 --pretty='format:%h')"
        echo "[$SUMMARY_PREFIX $SUMMARY_POSTFIX] $2" >exp &&
 
-       test_cmp exp act
+       if test_have_prereq C_LOCALE_OUTPUT
+       then
+               test_cmp exp act
+       fi
 }
 
 test_expect_success 'output summary format' '
@@ -32,7 +35,10 @@ test_expect_success 'output summary format' '
        check_summary_oneline "root-commit" "initial" &&
 
        echo change >>file1 &&
-       git add file1 &&
+       git add file1
+'
+
+test_expect_success 'output summary format: root-commit' '
        check_summary_oneline "" "a change"
 '
 
@@ -215,30 +221,35 @@ 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 C_LOCALE_OUTPUT 'cleanup commit messages (strip,-F,-e): output' '
+       test_cmp expect actual
 '
 
 echo "#
 # Author:    $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>
 #" >> expect
 
-test_expect_success 'author different from committer' '
+test_expect_success C_LOCALE_OUTPUT '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 C_LOCALE_OUTPUT 'author different from committer: output' '
        test_cmp expect actual
 '
 
@@ -248,17 +259,20 @@ rm -f expect.tmp
 echo "# Committer:
 #" >> expect
 
-test_expect_success 'committer is automatic' '
+test_expect_success C_LOCALE_OUTPUT 'committer is automatic' '
 
        echo >>negative &&
        (
-               unset GIT_COMMITTER_EMAIL
-               unset GIT_COMMITTER_NAME
+               sane_unset GIT_COMMITTER_EMAIL &&
+               sane_unset GIT_COMMITTER_NAME &&
                # must fail because there is no change
                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 C_LOCALE_OUTPUT 'committer is automatic: output' '
        test_cmp expect actual
 '
 
@@ -370,66 +384,66 @@ try_commit () {
 
 try_commit_status_combo () {
 
-       test_expect_success 'commit' '
+       test_expect_success C_LOCALE_OUTPUT 'commit' '
                clear_config commit.status &&
                try_commit "" &&
                grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
        '
 
-       test_expect_success 'commit' '
+       test_expect_success C_LOCALE_OUTPUT 'commit' '
                clear_config commit.status &&
                try_commit "" &&
                grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
        '
 
-       test_expect_success 'commit --status' '
+       test_expect_success C_LOCALE_OUTPUT 'commit --status' '
                clear_config commit.status &&
                try_commit --status &&
                grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
        '
 
-       test_expect_success 'commit --no-status' '
+       test_expect_success C_LOCALE_OUTPUT 'commit --no-status' '
                clear_config commit.status &&
-               try_commit --no-status
+               try_commit --no-status &&
                ! grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
        '
 
-       test_expect_success 'commit with commit.status = yes' '
+       test_expect_success C_LOCALE_OUTPUT 'commit with commit.status = yes' '
                clear_config commit.status &&
                git config commit.status yes &&
                try_commit "" &&
                grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
        '
 
-       test_expect_success 'commit with commit.status = no' '
+       test_expect_success C_LOCALE_OUTPUT 'commit with commit.status = no' '
                clear_config commit.status &&
                git config commit.status no &&
                try_commit "" &&
                ! grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
        '
 
-       test_expect_success 'commit --status with commit.status = yes' '
+       test_expect_success C_LOCALE_OUTPUT 'commit --status with commit.status = yes' '
                clear_config commit.status &&
                git config commit.status yes &&
                try_commit --status &&
                grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
        '
 
-       test_expect_success 'commit --no-status with commit.status = yes' '
+       test_expect_success C_LOCALE_OUTPUT 'commit --no-status with commit.status = yes' '
                clear_config commit.status &&
                git config commit.status yes &&
                try_commit --no-status &&
                ! grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
        '
 
-       test_expect_success 'commit --status with commit.status = no' '
+       test_expect_success C_LOCALE_OUTPUT 'commit --status with commit.status = no' '
                clear_config commit.status &&
                git config commit.status no &&
                try_commit --status &&
                grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
        '
 
-       test_expect_success 'commit --no-status with commit.status = no' '
+       test_expect_success C_LOCALE_OUTPUT 'commit --no-status with commit.status = no' '
                clear_config commit.status &&
                git config commit.status no &&
                try_commit --no-status &&