summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d71b8ba)
raw | patch | inline | side by side (parent: d71b8ba)
author | Pat Notz <patnotz@gmail.com> | |
Tue, 2 Nov 2010 19:59:10 +0000 (13:59 -0600) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 4 Nov 2010 20:53:35 +0000 (13:53 -0700) |
t7500: test expected behavior of commit --fixup
t3415: test interaction of commit --fixup with rebase --autosquash
t3900: test commit --fixup with i18n encodings
Signed-off-by: Pat Notz <patnotz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t3415: test interaction of commit --fixup with rebase --autosquash
t3900: test commit --fixup with i18n encodings
Signed-off-by: Pat Notz <patnotz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t3415-rebase-autosquash.sh | patch | blob | history | |
t/t3900-i18n-commit.sh | patch | blob | history | |
t/t7500-commit.sh | patch | blob | history |
index fd2184ce7159122ae8d1d65f5a228a7b91c5e02a..b77a413b1c954c0ab708cd5273ed49faad80f463 100755 (executable)
git add . &&
test_tick &&
git commit -m "first commit" &&
+ git tag first-commit &&
echo 3 >file3 &&
git add . &&
test_tick &&
git tag base
'
-test_auto_fixup() {
+test_auto_fixup () {
git reset --hard base &&
echo 1 >file1 &&
git add -u &&
test_must_fail test_auto_fixup final-fixup-config-false
'
-test_auto_squash() {
+test_auto_squash () {
git reset --hard base &&
echo 1 >file1 &&
git add -u &&
test 0 = $(git rev-list final-missquash...HEAD | wc -l)
'
+test_auto_commit_flags () {
+ git reset --hard base &&
+ echo 1 >file1 &&
+ git add -u &&
+ test_tick &&
+ git commit --$1 first-commit &&
+ git tag final-commit-$1 &&
+ test_tick &&
+ git rebase --autosquash -i HEAD^^^ &&
+ git log --oneline >actual &&
+ test 3 = $(wc -l <actual) &&
+ git diff --exit-code final-commit-$1 &&
+ test 1 = "$(git cat-file blob HEAD^:file1)" &&
+ test $2 = $(git cat-file commit HEAD^ | grep first | wc -l)
+}
+
+test_expect_success 'use commit --fixup' '
+ test_auto_commit_flags fixup 1
+'
+
test_done
diff --git a/t/t3900-i18n-commit.sh b/t/t3900-i18n-commit.sh
index 256c4c970145aa9f59e58ee1b0da4c6281b6d9e5..f4775ee28563676f169ae31f051002060a092701 100755 (executable)
--- a/t/t3900-i18n-commit.sh
+++ b/t/t3900-i18n-commit.sh
'
done
+test_commit_autosquash_flags () {
+ H=$1
+ flag=$2
+ test_expect_success "commit --$flag with $H encoding" '
+ git config i18n.commitencoding $H &&
+ git checkout -b $H-$flag C0 &&
+ echo $H >>F &&
+ git commit -a -F "$TEST_DIRECTORY"/t3900/$H.txt &&
+ test_tick &&
+ echo intermediate stuff >>G &&
+ git add G &&
+ git commit -a -m "intermediate commit" &&
+ test_tick &&
+ echo $H $flag >>F &&
+ git commit -a --$flag HEAD~1 $3 &&
+ E=$(git cat-file commit '$H-$flag' |
+ sed -ne "s/^encoding //p") &&
+ test "z$E" = "z$H" &&
+ git config --unset-all i18n.commitencoding &&
+ git rebase --autosquash -i HEAD^^^ &&
+ git log --oneline >actual &&
+ test 3 = $(wc -l <actual)
+ '
+}
+
+test_commit_autosquash_flags eucJP fixup
+
test_done
diff --git a/t/t7500-commit.sh b/t/t7500-commit.sh
index aa9c577e9e306bce05cd0fe076c56017c1b97e41..a41b819f6c96514bd07abd8cbba0cc38416801f6 100755 (executable)
--- a/t/t7500-commit.sh
+++ b/t/t7500-commit.sh
commit_msg_is "hello there"
'
+commit_for_rebase_autosquash_setup () {
+ echo "first content line" >>foo &&
+ git add foo &&
+ cat >log <<EOF &&
+target message subject line
+
+target message body line 1
+target message body line 2
+EOF
+ git commit -F log &&
+ echo "second content line" >>foo &&
+ git add foo &&
+ git commit -m "intermediate commit" &&
+ echo "third content line" >>foo &&
+ git add foo
+}
+
+test_expect_success 'commit --fixup provides correct one-line commit message' '
+ commit_for_rebase_autosquash_setup &&
+ git commit --fixup HEAD~1 &&
+ commit_msg_is "fixup! target message subject line"
+'
+
+test_expect_success 'invalid message options when using --fixup' '
+ echo changes >>foo &&
+ echo "message" >log &&
+ git add foo &&
+ test_must_fail git commit --fixup HEAD~1 -C HEAD~2 &&
+ test_must_fail git commit --fixup HEAD~1 -c HEAD~2 &&
+ test_must_fail git commit --fixup HEAD~1 -m "cmdline message" &&
+ test_must_fail git commit --fixup HEAD~1 -F log
+'
+
test_done