hooks: allow customizing where the hook directory is
[gitweb.git] / t / t4041-diff-submodule-option.sh
index 1751c8330709c56a4b7019513e30434741847b95..2d9731b52d6b880d742e4722ddcc404c59e5f1bd 100755 (executable)
@@ -11,6 +11,9 @@ This test tries to verify the sanity of the --submodule option of git diff.
 
 . ./test-lib.sh
 
+# Tested non-UTF-8 encoding
+test_encoding="ISO8859-1"
+
 # 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")
@@ -23,8 +26,10 @@ add_file () {
                        echo "$name" >"$name" &&
                        git add "$name" &&
                        test_tick &&
-                       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"
+                       # "git commit -m" would break MinGW, as Windows refuse to pass
+                       # $test_encoding encoded parameter to git.
+                       echo "Add $name ($added $name)" | iconv -f utf-8 -t $test_encoding |
+                       git -c "i18n.commitEncoding=$test_encoding" commit -F -
                done >/dev/null &&
                git rev-parse --short --verify HEAD
        )
@@ -523,10 +528,12 @@ test_expect_success 'diff --submodule with objects referenced by alternates' '
                sha1_before=$(git rev-parse --short HEAD)
                echo b >b &&
                git add b &&
-               git commit -m b
-               sha1_after=$(git rev-parse --short HEAD)
-               echo "Submodule sub $sha1_before..$sha1_after:
-  > b" >../expected
+               git commit -m b &&
+               sha1_after=$(git rev-parse --short HEAD) &&
+               {
+                       echo "Submodule sub $sha1_before..$sha1_after:" &&
+                       echo "  > b"
+               } >../expected
        ) &&
        (cd super &&
                (cd sub &&
@@ -534,7 +541,7 @@ test_expect_success 'diff --submodule with objects referenced by alternates' '
                        git checkout origin/master
                ) &&
                git diff --submodule > ../actual
-       )
+       ) &&
        test_cmp expected actual
 '