diff options
author | René Scharfe <rene.scharfe@lsrfire.ath.cx> | 2013-05-25 23:43:34 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-05-28 14:33:01 -0700 |
commit | 25206778aac776fc6cc4887653fdae476c7a9b5a (patch) | |
tree | 8e5d2d5caebaa9cf53e30381b9736e340ea7e5b3 /t/t7502-commit.sh | |
parent | 92758dd2a2de94c90c0697ef0e8174c3543a47f9 (diff) | |
download | git-25206778aac776fc6cc4887653fdae476c7a9b5a.tar.gz git-25206778aac776fc6cc4887653fdae476c7a9b5a.tar.xz |
commit: don't start editor if empty message is given with -m
If an empty message is specified with the option -m of git commit then
the editor is started. That's unexpected and unnecessary. Instead of
using the length of the message string for checking if the user
specified one, directly remember if the option -m was given.
Reported-by: Mislav Marohnić <mislav.marohnic@gmail.com>
Signed-off-by: René Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7502-commit.sh')
-rwxr-xr-x | t/t7502-commit.sh | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/t/t7502-commit.sh b/t/t7502-commit.sh index 292bc082b..91354d28b 100755 --- a/t/t7502-commit.sh +++ b/t/t7502-commit.sh @@ -354,6 +354,23 @@ test_expect_success !AUTOIDENT 'do not fire editor when committer is bogus' ' test_cmp expect .git/result ' +test_expect_success 'do not fire editor if -m <msg> was given' ' + echo tick >file && + git add file && + echo "editor not started" >.git/result && + (GIT_EDITOR="\"$(pwd)/.git/FAKE_EDITOR\"" git commit -m tick) && + test "$(cat .git/result)" = "editor not started" +' + +test_expect_success 'do not fire editor if -m "" was given' ' + echo tock >file && + git add file && + echo "editor not started" >.git/result && + (GIT_EDITOR="\"$(pwd)/.git/FAKE_EDITOR\"" \ + git commit -m "" --allow-empty-message) && + test "$(cat .git/result)" = "editor not started" +' + test_expect_success 'do not fire editor in the presence of conflicts' ' git clean -f && |