summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ca1ba20)
raw | patch | inline | side by side (parent: ca1ba20)
author | Jonathan Nieder <jrnieder@gmail.com> | |
Wed, 7 Dec 2011 14:54:14 +0000 (08:54 -0600) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 8 Dec 2011 23:35:34 +0000 (15:35 -0800) |
A quick test to make sure git doesn't lose the functionality added by
the recent patch "commit: honor --no-edit", plus another test to check
the classical --edit use case (use with "-m").
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
the recent patch "commit: honor --no-edit", plus another test to check
the classical --edit use case (use with "-m").
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t7501-commit.sh | patch | blob | history |
diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh
index bf025df6e1fb22d24f5f85f8fe0dcae8722ffbbb..8bb38337a9796142bc091c2b108f7f9e79b0f377 100755 (executable)
--- a/t/t7501-commit.sh
+++ b/t/t7501-commit.sh
EDITOR=./editor git commit --amend
'
+test_expect_success 'set up editor' '
+ cat >editor <<-\EOF &&
+ #!/bin/sh
+ sed -e "s/unamended/amended/g" <"$1" >"$1-"
+ mv "$1-" "$1"
+ EOF
+ chmod 755 editor
+'
+
+test_expect_success 'amend without launching editor' '
+ echo unamended >expect &&
+ git commit --allow-empty -m "unamended" &&
+ echo needs more bongo >file &&
+ git add file &&
+ EDITOR=./editor git commit --no-edit --amend &&
+ git diff --exit-code HEAD -- file &&
+ git diff-tree -s --format=%s HEAD >msg &&
+ test_cmp expect msg
+'
+
+test_expect_success '--amend --edit' '
+ echo amended >expect &&
+ git commit --allow-empty -m "unamended" &&
+ echo bongo again >file &&
+ git add file &&
+ EDITOR=./editor git commit --edit --amend &&
+ git diff-tree -s --format=%s HEAD >msg &&
+ test_cmp expect msg
+'
+
+test_expect_success '-m --edit' '
+ echo amended >expect &&
+ git commit --allow-empty -m buffer &&
+ echo bongo bongo >file &&
+ git add file &&
+ EDITOR=./editor git commit -m unamended --edit &&
+ git diff-tree -s --format=%s HEAD >msg &&
+ test_cmp expect msg
+'
+
test_expect_success '-m and -F do not mix' '
echo enough with the bongos >file &&
test_must_fail git commit -F msg -m amending .