3 test_description
='verbose commit template'
6 cat >check-for-diff
<<EOF
8 exec grep '^diff --git' "\$1"
10 chmod +x check-for-diff
11 test_set_editor
"$PWD/check-for-diff"
19 test_expect_success
'setup' '
25 test_expect_success
'initial commit shows verbose diff' '
29 test_expect_success
'second commit' '
30 echo content modified >file &&
36 git log
-1 --pretty=format
:%s
%n
%n
%b
>actual
&&
40 test_expect_success
'verbose diff is stripped out' '
41 git commit --amend -v &&
45 test_expect_success
'verbose diff is stripped out (mnemonicprefix)' '
46 git config diff.mnemonicprefix true &&
47 git commit --amend -v &&
52 This is an example commit message that contains a diff.
54 diff --git c/file i/file
56 index 0000000..f95c11d
63 test_expect_success
'diff in message is retained without -v' '
64 git commit --amend -F diff &&
68 test_expect_success
'diff in message is retained with -v' '
69 git commit --amend -F diff -v &&
73 test_expect_success
'submodule log is stripped out too with -v' '
74 git config diff.submodule log &&
75 git submodule add ./. sub &&
76 git commit -m "sub added" &&
80 git commit -a -m "submodule commit"
85 test_must_fail git commit -a -v 2>err
87 test_i18ngrep "Aborting commit due to empty commit message." err
90 test_expect_success
'verbose diff is stripped out with set core.commentChar' '
94 test_must_fail git -c core.commentchar=";" commit -a -v 2>err
96 test_i18ngrep "Aborting commit due to empty commit message." err