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

Commit

Permalink
tests: do not pass iso8859-1 encoded parameter
Browse files Browse the repository at this point in the history
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 <blees@dcon.de>
Author: Stepan Kasal <kasal@ucw.cz>
  • Loading branch information
patthoyts authored and dscho committed May 10, 2014
1 parent 986d2d4 commit ef4a733
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
6 changes: 4 additions & 2 deletions t/t4041-diff-submodule-option.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
2 changes: 1 addition & 1 deletion t/t4205-log-pretty-formats.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ test_expect_success 'set up basic repos' '
git add foo &&
test_tick &&
git config i18n.commitEncoding iso8859-1 &&
git commit -m "$(commit_msg iso8859-1)" &&
commit_msg iso8859-1 | git commit -F - &&
git add bar &&
test_tick &&
git commit -m "add bar" &&
Expand Down
4 changes: 2 additions & 2 deletions t/t6006-rev-list-format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ test_expect_success 'setup' '
: >foo &&
git add foo &&
git config i18n.commitEncoding iso8859-1 &&
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:) &&
Expand Down
8 changes: 6 additions & 2 deletions t/t7102-reset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
'

Expand Down

0 comments on commit ef4a733

Please sign in to comment.