Merge pull request #156 from kasal/test-fix-rev

Fix test suite issues with iso8859-1 parameters
This commit is contained in:
Johannes Schindelin
2014-04-10 13:53:50 -05:00
3 changed files with 16 additions and 9 deletions

View File

@@ -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" &&
@@ -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
)

View File

@@ -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" &&

View File

@@ -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
@@ -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
@@ -60,7 +62,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
'
@@ -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
'