Add option to git-commit to allow empty log messages
Change git-commit(1) to accept the --allow-empty-message option to allow a commit with an empty message. This is analogous to the existing --allow-empty option which allows a commit that records no changes. As these are mainly for interoperating with foreign SCM systems, and are not meant for normal use, ensure that "git commit -h" does not talk about them. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
537f6c7fb4
commit
c9b5fde759
@ -193,4 +193,26 @@ test_expect_success 'commit -F overrides -t' '
|
||||
commit_msg_is "-F log"
|
||||
'
|
||||
|
||||
test_expect_success 'Commit without message is allowed with --allow-empty-message' '
|
||||
echo "more content" >>foo &&
|
||||
git add foo &&
|
||||
>empty &&
|
||||
git commit --allow-empty-message <empty &&
|
||||
commit_msg_is ""
|
||||
'
|
||||
|
||||
test_expect_success 'Commit without message is no-no without --allow-empty-message' '
|
||||
echo "more content" >>foo &&
|
||||
git add foo &&
|
||||
>empty &&
|
||||
test_must_fail git commit <empty
|
||||
'
|
||||
|
||||
test_expect_success 'Commit a message with --allow-empty-message' '
|
||||
echo "even more content" >>foo &&
|
||||
git add foo &&
|
||||
git commit --allow-empty-message -m"hello there" &&
|
||||
commit_msg_is "hello there"
|
||||
'
|
||||
|
||||
test_done
|
||||
|
Reference in New Issue
Block a user