From: Pat Thoyts <pattho...@users.sourceforge.net>
Date: Mon, 2 Sep 2013 15:44:54 +0100

git commit -m with some iso8859-1 encoded stuff is doomed to fail in MinGW,
because Windows don't let you pass encoded bytes to a process (CreateProcessW
always takes a UTF-16LE encoded string).

It is safe to pass the iso8859-1 message using a file or a pipe.

Thanks-to: Karsten Blees <bl...@dcon.de>
Author: Stepan Kasal <ka...@ucw.cz>
Signed-off-by: Stepan Kasal <ka...@ucw.cz>
---
 t/t4041-diff-submodule-option.sh | 6 ++++--
 t/t4205-log-pretty-formats.sh    | 2 +-
 t/t6006-rev-list-format.sh       | 4 ++--
 t/t7102-reset.sh                 | 8 ++++++--
 4 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh
index 463d63b..e432896 100755
--- a/t/t4041-diff-submodule-option.sh
+++ b/t/t4041-diff-submodule-option.sh
@@ -26,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 $test_encoding) &&
-                       git -c "i18n.commitEncoding=$test_encoding" 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
        )
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
index c84ec9a..349c531 100755
--- a/t/t4205-log-pretty-formats.sh
+++ b/t/t4205-log-pretty-formats.sh
@@ -31,7 +31,7 @@ test_expect_success 'set up basic repos' '
        git add foo &&
        test_tick &&
        git config i18n.commitEncoding $test_encoding &&
-       git commit -m "$(commit_msg $test_encoding)" &&
+       commit_msg $test_encoding | git commit -F - &&
        git add bar &&
        test_tick &&
        git commit -m "add bar" &&
diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh
index 88ed319..a02a45a 100755
--- a/t/t6006-rev-list-format.sh
+++ b/t/t6006-rev-list-format.sh
@@ -35,13 +35,13 @@ test_expect_success 'setup' '
        : >foo &&
        git add foo &&
        git config i18n.commitEncoding $test_encoding &&
-       git commit -m "$added_iso88591" &&
+       echo "$added_iso88591" | git commit -F - &&
        head1=$(git rev-parse --verify HEAD) &&
        head1_short=$(git rev-parse --verify --short $head1) &&
        tree1=$(git rev-parse --verify HEAD:) &&
        tree1_short=$(git rev-parse --verify --short $tree1) &&
        echo "$changed" > foo &&
-       git commit -a -m "$changed_iso88591" &&
+       echo "$changed_iso88591" | git commit -a -F - &&
        head2=$(git rev-parse --verify HEAD) &&
        head2_short=$(git rev-parse --verify --short $head2) &&
        tree2=$(git rev-parse --verify HEAD:) &&
diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh
index ee703be..98bcfe2 100755
--- a/t/t7102-reset.sh
+++ b/t/t7102-reset.sh
@@ -44,7 +44,9 @@ test_expect_success 'creating initial files and commits' '
 
        echo "1st line 2nd file" >secondfile &&
        echo "2nd line 2nd file" >>secondfile &&
-       git -c "i18n.commitEncoding=$test_encoding" commit -a -m "$(commit_msg 
$test_encoding)" &&
+       # "git commit -m" would break MinGW, as Windows refuse to pass
+       # $test_encoding encoded parameter to git.
+       commit_msg $test_encoding | git -c "i18n.commitEncoding=$test_encoding" 
commit -a -F - &&
        head5=$(git rev-parse --verify HEAD)
 '
 # git log --pretty=oneline # to see those SHA1 involved
@@ -334,7 +336,9 @@ test_expect_success 'redoing the last two commits should 
succeed' '
 
        echo "1st line 2nd file" >secondfile &&
        echo "2nd line 2nd file" >>secondfile &&
-       git -c "i18n.commitEncoding=$test_encoding" commit -a -m "$(commit_msg 
$test_encoding)" &&
+       # "git commit -m" would break MinGW, as Windows refuse to pass
+       # $test_encoding encoded parameter to git.
+       commit_msg $test_encoding | git -c "i18n.commitEncoding=$test_encoding" 
commit -a -F - &&
        check_changes $head5
 '
 
-- 
2.0.0.9635.g0be03cb

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to