. ./test-lib.sh
commit_msg () {
- # String "modify 2nd file (changed)" partly in German(translated with Google Translate),
+ # String "modify 2nd file (changed)" partly in German
+ # (translated with Google Translate),
# encoded in UTF-8, used as a commit log message below.
- msg=$(printf "modify 2nd file (ge\303\244ndert)")
+ msg="modify 2nd file (ge\303\244ndert)\n"
if test -n "$1"
then
- msg=$(echo $msg | iconv -f utf-8 -t $1)
+ printf "$msg" | iconv -f utf-8 -t "$1"
+ else
+ printf "$msg"
fi
- echo $msg
}
test_expect_success 'creating initial files and commits' '
echo "1st line 2nd file" >secondfile &&
echo "2nd line 2nd file" >>secondfile &&
- git -c "i18n.commitEncoding=iso-8859-1" commit -a -m "$(commit_msg iso-8859-1)" &&
+ git -c "i18n.commitEncoding=iso8859-1" commit -a -m "$(commit_msg iso8859-1)" &&
head5=$(git rev-parse --verify HEAD)
'
# git log --pretty=oneline # to see those SHA1 involved
done | test_cmp .cat_expect -
}
-test_expect_failure 'reset --hard message' '
+test_expect_success 'reset --hard message' '
hex=$(git log -1 --format="%h") &&
git reset --hard > .actual &&
echo HEAD is now at $hex $(commit_msg) > .expected &&
test_cmp .expected .actual
'
-test_expect_success 'reset --hard message (iso-8859-1 logoutencoding)' '
+test_expect_success 'reset --hard message (iso8859-1 logoutputencoding)' '
hex=$(git log -1 --format="%h") &&
- git -c "i18n.logOutputEncoding=iso-8859-1" reset --hard > .actual &&
- echo HEAD is now at $hex $(commit_msg iso-8859-1) > .expected &&
+ git -c "i18n.logOutputEncoding=iso8859-1" reset --hard > .actual &&
+ echo HEAD is now at $hex $(commit_msg iso8859-1) > .expected &&
test_cmp .expected .actual
'
echo "1st line 2nd file" >secondfile &&
echo "2nd line 2nd file" >>secondfile &&
- git -c "i18n.commitEncoding=iso-8859-1" commit -a -m "$(commit_msg iso-8859-1)" &&
+ git -c "i18n.commitEncoding=iso8859-1" commit -a -m "$(commit_msg iso8859-1)" &&
check_changes $head5
'
test_must_fail git diff --quiet -- secondfile &&
test -z "$(git diff --cached --name-only)" &&
test -f secondfile &&
- test ! -s secondfile
+ test_must_be_empty secondfile
'