Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-07-12 23:04:01 +0400
committerJunio C Hamano <gitster@pobox.com>2013-07-12 23:04:01 +0400
commit8a6482227ca31bd582aecbd211b85ff76595d0a7 (patch)
tree6f425dad28a02232a333bd04189af809b2366c6d /t/t7102-reset.sh
parentdacd2bcc414e0b7aac36aaa400da0a743c4741cc (diff)
parent37eb772ef3a5da0b28d3759373d714b349306ea4 (diff)
Merge branch 'as/log-output-encoding-in-user-format'
"log --format=" did not honor i18n.logoutputencoding configuration and this attempts to fix it. * as/log-output-encoding-in-user-format: t4205 (log-pretty-formats): avoid using `sed` t6006 (rev-list-format): add tests for "%b" and "%s" for the case i18n.commitEncoding is not set t4205, t6006, t7102: make functions better readable t4205 (log-pretty-formats): revert back single quotes t4041, t4205, t6006, t7102: use iso8859-1 rather than iso-8859-1 t4205: replace .\+ with ..* in sed commands pretty: --format output should honor logOutputEncoding pretty: Add failing tests: --format output should honor logOutputEncoding t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputs t7102 (reset): don't hardcode SHA-1 in expected outputs t6006 (rev-list-format): don't hardcode SHA-1 in expected outputs
Diffstat (limited to 't/t7102-reset.sh')
-rwxr-xr-xt/t7102-reset.sh39
1 files changed, 34 insertions, 5 deletions
diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh
index 300be86c38..8d4b50d1b5 100755
--- a/t/t7102-reset.sh
+++ b/t/t7102-reset.sh
@@ -9,6 +9,19 @@ Documented tests for git reset'
. ./test-lib.sh
+commit_msg () {
+ # String "modify 2nd file (changed)" partly in German
+ # (translated with Google Translate),
+ # encoded in UTF-8, used as a commit log message below.
+ msg="modify 2nd file (ge\303\244ndert)\n"
+ if test -n "$1"
+ then
+ printf "$msg" | iconv -f utf-8 -t "$1"
+ else
+ printf "$msg"
+ fi
+}
+
test_expect_success 'creating initial files and commits' '
test_tick &&
echo "1st file" >first &&
@@ -28,7 +41,7 @@ test_expect_success 'creating initial files and commits' '
echo "1st line 2nd file" >secondfile &&
echo "2nd line 2nd file" >>secondfile &&
- git commit -a -m "modify 2nd file" &&
+ 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
@@ -44,6 +57,20 @@ check_changes () {
done | test_cmp .cat_expect -
}
+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 (iso8859-1 logoutputencoding)' '
+ hex=$(git log -1 --format="%h") &&
+ git -c "i18n.logOutputEncoding=iso8859-1" reset --hard > .actual &&
+ echo HEAD is now at $hex $(commit_msg iso8859-1) > .expected &&
+ test_cmp .expected .actual
+'
+
>.diff_expect
>.cached_expect
cat >.cat_expect <<EOF
@@ -192,7 +219,8 @@ test_expect_success \
'changing files and redo the last commit should succeed' '
echo "3rd line 2nd file" >>secondfile &&
git commit -a -C ORIG_HEAD &&
- check_changes 3d3b7be011a58ca0c179ae45d94e6c83c0b0cd0d &&
+ head4=$(git rev-parse --verify HEAD) &&
+ check_changes $head4 &&
test "$(git rev-parse ORIG_HEAD)" = \
$head5
'
@@ -211,7 +239,7 @@ test_expect_success \
git reset --hard HEAD~2 &&
check_changes ddaefe00f1da16864591c61fdc7adb5d7cd6b74e &&
test "$(git rev-parse ORIG_HEAD)" = \
- 3d3b7be011a58ca0c179ae45d94e6c83c0b0cd0d
+ $head4
'
>.diff_expect
@@ -303,7 +331,7 @@ test_expect_success 'redoing the last two commits should succeed' '
echo "1st line 2nd file" >secondfile &&
echo "2nd line 2nd file" >>secondfile &&
- git commit -a -m "modify 2nd file" &&
+ git -c "i18n.commitEncoding=iso8859-1" commit -a -m "$(commit_msg iso8859-1)" &&
check_changes $head5
'
@@ -326,10 +354,11 @@ test_expect_success '--hard reset to HEAD should clear a failed merge' '
git checkout branch2 &&
echo "3rd line in branch2" >>secondfile &&
git commit -a -m "change in branch2" &&
+ head3=$(git rev-parse --verify HEAD) &&
test_must_fail git pull . branch1 &&
git reset --hard &&
- check_changes 77abb337073fb4369a7ad69ff6f5ec0e4d6b54bb
+ check_changes $head3
'
>.diff_expect