summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2016-05-02 14:24:09 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2016-05-02 14:24:09 -0700
commit12c5cd774e26acfea66e19e8fba53faf9507322f (patch)
treea15dbe4943d43ecebf72fd791b1023c1e1576dac /t
parentMerge branch 'sb/submodule-helper-clone-regression-fix' into maint (diff)
parentcommit: do not ignore an empty message given by -m '' (diff)
downloadtgif-12c5cd774e26acfea66e19e8fba53faf9507322f.tar.xz
Merge branch 'ad/commit-have-m-option' into maint
"git commit" misbehaved in a few minor ways when an empty message is given via -m '', all of which has been corrected. * ad/commit-have-m-option: commit: do not ignore an empty message given by -m '' commit: --amend -m '' silently fails to wipe message
Diffstat (limited to 't')
-rwxr-xr-xt/t7501-commit.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh
index 63e04277f9..900f7de05a 100755
--- a/t/t7501-commit.sh
+++ b/t/t7501-commit.sh
@@ -200,6 +200,26 @@ test_expect_success '--amend --edit of empty message' '
test_cmp expect msg
'
+test_expect_success '--amend to set message to empty' '
+ echo bata >file &&
+ git add file &&
+ git commit -m "unamended" &&
+ git commit --amend --allow-empty-message -m "" &&
+ git diff-tree -s --format=%s HEAD >msg &&
+ echo "" >expect &&
+ test_cmp expect msg
+'
+
+test_expect_success '--amend to set empty message needs --allow-empty-message' '
+ echo conga >file &&
+ git add file &&
+ git commit -m "unamended" &&
+ test_must_fail git commit --amend -m "" &&
+ git diff-tree -s --format=%s HEAD >msg &&
+ echo "unamended" >expect &&
+ test_cmp expect msg
+'
+
test_expect_success '-m --edit' '
echo amended >expect &&
git commit --allow-empty -m buffer &&