From cecc1323addb252811cf5c278878696daf2d599d Mon Sep 17 00:00:00 2001 From: Stepan Kasal Date: Wed, 9 Apr 2014 17:28:53 +0200 Subject: [PATCH 1/3] Revert "t4041: ensure the utf-8 encoded string really gets stored as utf-8." This reverts commit 2482bc95bfb321bae3bb70d6516df53efc631261. --- t/t4041-diff-submodule-option.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh index 306b233e270558..1751c8330709c5 100755 --- a/t/t4041-diff-submodule-option.sh +++ b/t/t4041-diff-submodule-option.sh @@ -13,7 +13,7 @@ This test tries to verify the sanity of the --submodule option of git diff. # 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" | iconv -t utf-8) +added=$(printf "hinzugef\303\274gt") add_file () { ( cd "$1" && From 685785896da0ee4f9477296760796d4579c86615 Mon Sep 17 00:00:00 2001 From: Stepan Kasal Date: Wed, 9 Apr 2014 17:29:25 +0200 Subject: [PATCH 2/3] Revert "t7102: do not assume the system encoding is utf-8" This reverts commit a0530b4ffca5c5f4a631c15e057b901f57312274. --- t/t7102-reset.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh index b05910962b27e3..8d4b50d1b5816d 100755 --- a/t/t7102-reset.sh +++ b/t/t7102-reset.sh @@ -16,7 +16,7 @@ commit_msg () { msg="modify 2nd file (ge\303\244ndert)\n" if test -n "$1" then - printf "$msg" | iconv -t "$1" + printf "$msg" | iconv -f utf-8 -t "$1" else printf "$msg" fi @@ -60,7 +60,7 @@ check_changes () { test_expect_success 'reset --hard message' ' hex=$(git log -1 --format="%h") && git reset --hard > .actual && - echo HEAD is now at $hex $(commit_msg utf-8) > .expected && + echo HEAD is now at $hex $(commit_msg) > .expected && test_cmp .expected .actual ' From 126c186941fe37e1cf69fe2b8d1baca08ef11ae4 Mon Sep 17 00:00:00 2001 From: Stepan Kasal Date: Wed, 9 Apr 2014 16:45:25 +0200 Subject: [PATCH 3/3] t4041, t7102: do not pass iso8859-1 parameter 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). Fix t4041, t7102 and update an older fix in t4205. Thanks-to: Karsten Blees --- t/t4041-diff-submodule-option.sh | 6 ++++-- t/t4205-log-pretty-formats.sh | 5 +++-- t/t7102-reset.sh | 8 ++++++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh index 1751c8330709c5..01e1f9be77617e 100755 --- a/t/t4041-diff-submodule-option.sh +++ b/t/t4041-diff-submodule-option.sh @@ -23,8 +23,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 + # iso8859-1 encoded parameter to git. + echo "Add $name ($added $name)" | iconv -f utf-8 -t iso8859-1 | + git -c 'i18n.commitEncoding=iso8859-1' 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 ca532d36d2d61a..f27b0b390af13f 100755 --- a/t/t4205-log-pretty-formats.sh +++ b/t/t4205-log-pretty-formats.sh @@ -28,8 +28,9 @@ test_expect_success 'set up basic repos' ' git add foo && test_tick && git config i18n.commitEncoding iso8859-1 && - commit_msg iso8859-1 > commit_msg && - git commit --file commit_msg && + # "git commit -m" would break MinGW, as Windows refuse to pass + # iso8859-1 encoded parameter to git. + commit_msg iso8859-1 | git commit -F - && git add bar && test_tick && git commit -m "add bar" && diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh index 8d4b50d1b5816d..b5fa177a54b07c 100755 --- a/t/t7102-reset.sh +++ b/t/t7102-reset.sh @@ -41,7 +41,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=iso8859-1" commit -a -m "$(commit_msg iso8859-1)" && + # "git commit -m" would break MinGW, as Windows refuse to pass + # iso8859-1 encoded parameter to git. + commit_msg iso8859-1 | git -c "i18n.commitEncoding=iso8859-1" commit -a -F - && head5=$(git rev-parse --verify HEAD) ' # git log --pretty=oneline # to see those SHA1 involved @@ -331,7 +333,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=iso8859-1" commit -a -m "$(commit_msg iso8859-1)" && + # "git commit -m" would break MinGW, as Windows refuse to pass + # iso8859-1 encoded parameter to git. + commit_msg iso8859-1 | git -c "i18n.commitEncoding=iso8859-1" commit -a -F - && check_changes $head5 '