Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 3ed8dae

Browse files
patthoytskasal
authored andcommitted
tests: do not pass iso8859-1 encoded 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). It is safe to pass the iso8859-1 message using a file or a pipe. Thanks-to: Karsten Blees <[email protected]> Author: Stepan Kasal <[email protected]>
1 parent 6fcf76f commit 3ed8dae

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

t/t4041-diff-submodule-option.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ add_file () {
2323
echo "$name" >"$name" &&
2424
git add "$name" &&
2525
test_tick &&
26-
msg_added_iso88591=$(echo "Add $name ($added $name)" | iconv -f utf-8 -t iso8859-1) &&
27-
git -c 'i18n.commitEncoding=iso8859-1' commit -m "$msg_added_iso88591"
26+
# "git commit -m" would break MinGW, as Windows refuse to pass
27+
# iso8859-1 encoded parameter to git.
28+
echo "Add $name ($added $name)" | iconv -f utf-8 -t iso8859-1 |
29+
git -c 'i18n.commitEncoding=iso8859-1' commit -F -
2830
done >/dev/null &&
2931
git rev-parse --short --verify HEAD
3032
)

t/t4205-log-pretty-formats.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ test_expect_success 'set up basic repos' '
2828
git add foo &&
2929
test_tick &&
3030
git config i18n.commitEncoding iso8859-1 &&
31-
git commit -m "$(commit_msg iso8859-1)" &&
31+
commit_msg iso8859-1 | git commit -F - &&
3232
git add bar &&
3333
test_tick &&
3434
git commit -m "add bar" &&

t/t6006-rev-list-format.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ test_expect_success 'setup' '
2222
: >foo &&
2323
git add foo &&
2424
git config i18n.commitEncoding iso8859-1 &&
25-
git commit -m "$added_iso88591" &&
25+
echo "$added_iso88591" | git commit -F - &&
2626
head1=$(git rev-parse --verify HEAD) &&
2727
head1_short=$(git rev-parse --verify --short $head1) &&
2828
tree1=$(git rev-parse --verify HEAD:) &&
2929
tree1_short=$(git rev-parse --verify --short $tree1) &&
3030
echo "$changed" > foo &&
31-
git commit -a -m "$changed_iso88591" &&
31+
echo "$changed_iso88591" | git commit -a -F - &&
3232
head2=$(git rev-parse --verify HEAD) &&
3333
head2_short=$(git rev-parse --verify --short $head2) &&
3434
tree2=$(git rev-parse --verify HEAD:) &&

t/t7102-reset.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ test_expect_success 'creating initial files and commits' '
4141
4242
echo "1st line 2nd file" >secondfile &&
4343
echo "2nd line 2nd file" >>secondfile &&
44-
git -c "i18n.commitEncoding=iso8859-1" commit -a -m "$(commit_msg iso8859-1)" &&
44+
# "git commit -m" would break MinGW, as Windows refuse to pass
45+
# iso8859-1 encoded parameter to git.
46+
commit_msg iso8859-1 | git -c "i18n.commitEncoding=iso8859-1" commit -a -F - &&
4547
head5=$(git rev-parse --verify HEAD)
4648
'
4749
# git log --pretty=oneline # to see those SHA1 involved
@@ -331,7 +333,9 @@ test_expect_success 'redoing the last two commits should succeed' '
331333
332334
echo "1st line 2nd file" >secondfile &&
333335
echo "2nd line 2nd file" >>secondfile &&
334-
git -c "i18n.commitEncoding=iso8859-1" commit -a -m "$(commit_msg iso8859-1)" &&
336+
# "git commit -m" would break MinGW, as Windows refuse to pass
337+
# iso8859-1 encoded parameter to git.
338+
commit_msg iso8859-1 | git -c "i18n.commitEncoding=iso8859-1" commit -a -F - &&
335339
check_changes $head5
336340
'
337341

0 commit comments

Comments
 (0)