summaryrefslogtreecommitdiff
path: root/t/t7500-commit.sh
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2010-04-06 08:40:35 +0000
committerJunio C Hamano <gitster@pobox.com>2010-04-07 15:22:57 -0700
commitc9b5fde7593ac88b1c475bea51d21ba1a1d57d65 (patch)
tree51f4e4875024f41429762f2bf5fd6d8108e0ec9d /t/t7500-commit.sh
parent537f6c7fb40257776a513128043112ea43b5cdb8 (diff)
downloadgit-c9b5fde7593ac88b1c475bea51d21ba1a1d57d65.tar.gz
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>
Diffstat (limited to 't/t7500-commit.sh')
-rwxr-xr-xt/t7500-commit.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/t/t7500-commit.sh b/t/t7500-commit.sh
index 9f5c3edb03..aa9c577e9e 100755
--- a/t/t7500-commit.sh
+++ b/t/t7500-commit.sh
@@ -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