Code

Merge branch 'jn/request-pull'
[git.git] / t / t7500-commit.sh
index 6e18a96319bef5c4ddfbc86ce79b02b364f04387..aa9c577e9e306bce05cd0fe076c56017c1b97e41 100755 (executable)
@@ -149,11 +149,8 @@ EOF
 
 test_expect_success '--signoff' '
        echo "yet another content *narf*" >> foo &&
-       echo "zort" | (
-               test_set_editor "$TEST_DIRECTORY"/t7500/add-content &&
-               git commit -s -F - foo
-       ) &&
-       git cat-file commit HEAD | sed "1,/^$/d" > output &&
+       echo "zort" | git commit -s -F - foo &&
+       git cat-file commit HEAD | sed "1,/^\$/d" > output &&
        test_cmp expect output
 '
 
@@ -186,4 +183,36 @@ test_expect_success 'commit message from stdin' '
        commit_msg_is "Log with foo word"
 '
 
+test_expect_success 'commit -F overrides -t' '
+       (
+               cd subdir &&
+               echo "-F log" > f.log &&
+               echo "-t template" > t.template &&
+               git commit --allow-empty -F f.log -t t.template
+       ) &&
+       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