Merge branch 'es/blame-L-breakage'
[gitweb.git] / t / t4041-diff-submodule-option.sh
index 32d4a604250d55e9221a416638c8c8c4fdd6ff87..1751c8330709c56a4b7019513e30434741847b95 100755 (executable)
@@ -1,6 +1,7 @@
 #!/bin/sh
 #
 # Copyright (c) 2009 Jens Lehmann, based on t7401 by Ping Yin
+# Copyright (c) 2011 Alexey Shumkin (+ non-UTF-8 commit encoding tests)
 #
 
 test_description='Support for verbose submodule differences in git diff
@@ -10,6 +11,9 @@ This test tries to verify the sanity of the --submodule option of git diff.
 
 . ./test-lib.sh
 
+# String "added" in German (translated with Google Translate), encoded in UTF-8,
+# used in sample commit log messages in add_file() function below.
+added=$(printf "hinzugef\303\274gt")
 add_file () {
        (
                cd "$1" &&
@@ -19,7 +23,8 @@ add_file () {
                        echo "$name" >"$name" &&
                        git add "$name" &&
                        test_tick &&
-                       git commit -m "Add $name" || exit
+                       msg_added_iso88591=$(echo "Add $name ($added $name)" | iconv -f utf-8 -t iso8859-1) &&
+                       git -c 'i18n.commitEncoding=iso8859-1' commit -m "$msg_added_iso88591"
                done >/dev/null &&
                git rev-parse --short --verify HEAD
        )
@@ -93,7 +98,7 @@ test_expect_success 'modified submodule(forward)' '
        git diff-index -p --submodule=log HEAD >actual &&
        cat >expected <<-EOF &&
        Submodule sm1 $head1..$head2:
-         > Add foo3
+         > Add foo3 ($added foo3)
        EOF
        test_cmp expected actual
 '
@@ -102,7 +107,7 @@ test_expect_success 'modified submodule(forward)' '
        git diff --submodule=log >actual &&
        cat >expected <<-EOF &&
        Submodule sm1 $head1..$head2:
-         > Add foo3
+         > Add foo3 ($added foo3)
        EOF
        test_cmp expected actual
 '
@@ -111,7 +116,7 @@ test_expect_success 'modified submodule(forward) --submodule' '
        git diff --submodule >actual &&
        cat >expected <<-EOF &&
        Submodule sm1 $head1..$head2:
-         > Add foo3
+         > Add foo3 ($added foo3)
        EOF
        test_cmp expected actual
 '
@@ -142,8 +147,8 @@ test_expect_success 'modified submodule(backward)' '
        git diff-index -p --submodule=log HEAD >actual &&
        cat >expected <<-EOF &&
        Submodule sm1 $head2..$head3 (rewind):
-         < Add foo3
-         < Add foo2
+         < Add foo3 ($added foo3)
+         < Add foo2 ($added foo2)
        EOF
        test_cmp expected actual
 '
@@ -153,10 +158,10 @@ test_expect_success 'modified submodule(backward and forward)' '
        git diff-index -p --submodule=log HEAD >actual &&
        cat >expected <<-EOF &&
        Submodule sm1 $head2...$head4:
-         > Add foo5
-         > Add foo4
-         < Add foo3
-         < Add foo2
+         > Add foo5 ($added foo5)
+         > Add foo4 ($added foo4)
+         < Add foo3 ($added foo3)
+         < Add foo2 ($added foo2)
        EOF
        test_cmp expected actual
 '