Code

Merge gitk changes from Paul Mackerras at git://ozlabs.org/~paulus/gitk
[git.git] / t / t7502-commit.sh
index ac2e187a5720d1ff947e58073dd6cc403ef40d5d..3f3adc31b98773d26715089c25d8d923dd342717 100755 (executable)
@@ -22,7 +22,7 @@ check_summary_oneline() {
        SUMMARY_POSTFIX="$(git log -1 --pretty='format:%h')"
        echo "[$SUMMARY_PREFIX $SUMMARY_POSTFIX] $2" >exp &&
 
-       test_cmp exp act
+       test_i18ncmp exp act
 }
 
 test_expect_success 'output summary format' '
@@ -32,7 +32,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,19 +218,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 'cleanup commit messages (strip,-F,-e): output' '
+       test_i18ncmp expect actual
 '
 
 echo "#
@@ -235,11 +240,10 @@ echo "#
 #" >> expect
 
 test_expect_success 'author different from committer' '
-
        echo >>negative &&
-       git commit -e -m "sample"
+       test_might_fail git commit -e -m "sample" &&
        head -n 7 .git/COMMIT_EDITMSG >actual &&
-       test_cmp expect actual
+       test_i18ncmp expect actual
 '
 
 mv expect expect.tmp
@@ -252,14 +256,14 @@ test_expect_success '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 &&
-       test_cmp expect actual
+       sed "s/^# Committer: .*/# Committer:/" >actual
+       test_i18ncmp expect actual
 '
 
 pwd=`pwd`
@@ -362,9 +366,9 @@ try_commit () {
        GIT_EDITOR=.git/FAKE_EDITOR git commit -a $* $use_template &&
        case "$use_template" in
        '')
-               ! grep "^## Custom template" .git/COMMIT_EDITMSG ;;
+               test_i18ngrep ! "^## Custom template" .git/COMMIT_EDITMSG ;;
        *)
-               grep "^## Custom template" .git/COMMIT_EDITMSG ;;
+               test_i18ngrep "^## Custom template" .git/COMMIT_EDITMSG ;;
        esac
 }
 
@@ -373,67 +377,67 @@ try_commit_status_combo () {
        test_expect_success 'commit' '
                clear_config commit.status &&
                try_commit "" &&
-               grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
+               test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
        '
 
        test_expect_success 'commit' '
                clear_config commit.status &&
                try_commit "" &&
-               grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
+               test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
        '
 
        test_expect_success 'commit --status' '
                clear_config commit.status &&
                try_commit --status &&
-               grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
+               test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
        '
 
        test_expect_success 'commit --no-status' '
                clear_config commit.status &&
-               try_commit --no-status
-               ! grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
+               try_commit --no-status &&
+               test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG
        '
 
        test_expect_success '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_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
        '
 
        test_expect_success '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_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG
        '
 
        test_expect_success '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_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
        '
 
        test_expect_success '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_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG
        '
 
        test_expect_success '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_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
        '
 
        test_expect_success 'commit --no-status with commit.status = no' '
                clear_config commit.status &&
                git config commit.status no &&
                try_commit --no-status &&
-               ! grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
+               test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG
        '
 
 }