(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: {(SQ <'verbose commit template'>)} spids: [4] ) ] ) (C {<.>} {<'./test-lib.sh'>}) (command.AndOr ops: [Id.Op_DAmp] children: [ (command.Simple words: [{<write_script>} {(DQ <check-for-diff>)}] redirects: [ (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'>) <OF>} here_end_span_id: 28 stdin_parts: [<'grep \'^diff --git\' "$1" >out\n'> <'exit 0\n'>] ) ) ] do_fork: T ) (C {<test_set_editor>} {(DQ ($ Id.VSub_DollarName '$PWD') <'/check-for-diff'>)}) ] ) (command.Simple words: [{<cat>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<message>}) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {(SQ <EOF>)} here_end_span_id: 50 stdin_parts: [<'subject\n'> <'\n'> <'body\n'>] ) ) ] do_fork: T ) (C {<test_expect_success>} {(SQ <setup>)} { (SQ <'\n'> <'\techo content >file &&\n'> <'\tgit add file &&\n'> <'\tgit commit -F message\n'>) } ) (C {<test_expect_success>} {(SQ <'initial commit shows verbose diff'>)} {(SQ <'\n'> <'\tgit commit --amend -v &&\n'> <'\ttest_line_count = 1 out\n'>)} ) (C {<test_expect_success>} {(SQ <'second commit'>)} { (SQ <'\n'> <'\techo content modified >file &&\n'> <'\tgit add file &&\n'> <'\tgit commit -F message\n'> ) } ) (command.ShFunction name: check_message body: (BraceGroup children: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (command.Simple words: [ {<git>} {<log>} {<-1>} {<--pretty> <Id.Lit_Equals '='> <format> <Id.Lit_Colon ':'> <Id.Lit_Other '%'> <s> <Id.Lit_Other '%'> <n> <Id.Lit_Other '%'> <n> <Id.Lit_Other '%'> <b> } ] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<actual>})] do_fork: T ) (C {<test_cmp>} {(DQ ($ Id.VSub_Number '$1'))} {<actual>}) ] ) ] ) ) (C {<test_expect_success>} {(SQ <'verbose diff is stripped out'>)} { (SQ <'\n'> <'\tgit commit --amend -v &&\n'> <'\tcheck_message message &&\n'> <'\ttest_line_count = 1 out\n'> ) } ) (C {<test_expect_success>} {(SQ <'verbose diff is stripped out (mnemonicprefix)'>)} { (SQ <'\n'> <'\tgit config diff.mnemonicprefix true &&\n'> <'\tgit commit --amend -v &&\n'> <'\tcheck_message message &&\n'> <'\ttest_line_count = 1 out\n'> ) } ) (command.Simple words: [{<cat>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<diff>}) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {(SQ <EOF>)} here_end_span_id: 184 stdin_parts: [ <'This is an example commit message that contains a diff.\n'> <'\n'> <'diff --git c/file i/file\n'> <'new file mode 100644\n'> <'index 0000000..f95c11d\n'> <'--- /dev/null\n'> <'+++ i/file\n'> <'@@ -0,0 +1 @@\n'> <'+this is some content\n'> ] ) ) ] do_fork: T ) (C {<test_expect_success>} {(SQ <'diff in message is retained without -v'>)} {(SQ <'\n'> <'\tgit commit --amend -F diff &&\n'> <'\tcheck_message diff\n'>)} ) (C {<test_expect_success>} {(SQ <'diff in message is retained with -v'>)} {(SQ <'\n'> <'\tgit commit --amend -F diff -v &&\n'> <'\tcheck_message diff\n'>)} ) (C {<test_expect_success>} {(SQ <'submodule log is stripped out too with -v'>)} { (SQ <'\n'> <'\tgit config diff.submodule log &&\n'> <'\tgit submodule add ./. sub &&\n'> <'\tgit commit -m "sub added" &&\n'> <'\t(\n'> <'\t\tcd sub &&\n'> <'\t\techo "more" >>file &&\n'> <'\t\tgit commit -a -m "submodule commit"\n'> <'\t) &&\n'> <'\t(\n'> <'\t\tGIT_EDITOR=cat &&\n'> <'\t\texport GIT_EDITOR &&\n'> <'\t\ttest_must_fail git commit -a -v 2>err\n'> <'\t) &&\n'> <'\ttest_i18ngrep "Aborting commit due to empty commit message." err\n'> ) } ) (C {<test_expect_success>} {(SQ <'verbose diff is stripped out with set core.commentChar'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tGIT_EDITOR=cat &&\n'> <'\t\texport GIT_EDITOR &&\n'> <'\t\ttest_must_fail git -c core.commentchar=";" commit -a -v 2>err\n'> <'\t) &&\n'> <'\ttest_i18ngrep "Aborting commit due to empty commit message." err\n'> ) } ) (C {<test_expect_success>} {(SQ <'status does not verbose without --verbose'>)} {(SQ <'\n'> <'\tgit status >actual &&\n'> <'\t! grep "^diff --git" actual\n'>)} ) (C {<test_expect_success>} {(SQ <'setup -v -v'>)} {(SQ <'\n'> <'\techo dirty >file\n'>)}) (command.ForEach iter_name: i iter_words: [{<true>} {<1>}] do_arg_iter: F body: (command.DoGroup children: [ (C {<test_expect_success>} {(DQ <'commit.verbose='> ($ Id.VSub_DollarName '$i') <' and --verbose omitted'>)} { (DQ <'\n'> <'\t\tgit -c commit.verbose='> ($ Id.VSub_DollarName '$i') <' commit --amend &&\n'> <'\t\ttest_line_count = 1 out\n'> <'\t'> ) } ) ] ) ) (command.ForEach iter_name: i iter_words: [{<false>} {<-2>} {<-1>} {<0>}] do_arg_iter: F body: (command.DoGroup children: [ (C {<test_expect_success>} {(DQ <'commit.verbose='> ($ Id.VSub_DollarName '$i') <' and --verbose omitted'>)} { (DQ <'\n'> <'\t\tgit -c commit.verbose='> ($ Id.VSub_DollarName '$i') <' commit --amend &&\n'> <'\t\ttest_line_count = 0 out\n'> <'\t'> ) } ) ] ) ) (command.ForEach iter_name: i iter_words: [{<2>} {<3>}] do_arg_iter: F body: (command.DoGroup children: [ (C {<test_expect_success>} {(DQ <'commit.verbose='> ($ Id.VSub_DollarName '$i') <' and --verbose omitted'>)} { (DQ <'\n'> <'\t\tgit -c commit.verbose='> ($ Id.VSub_DollarName '$i') <' commit --amend &&\n'> <'\t\ttest_line_count = 2 out\n'> <'\t'> ) } ) ] ) ) (command.ForEach iter_name: i iter_words: [{<true>} {<false>} {<-2>} {<-1>} {<0>} {<1>} {<2>} {<3>}] do_arg_iter: F body: (command.DoGroup children: [ (C {<test_expect_success>} {(DQ <'commit.verbose='> ($ Id.VSub_DollarName '$i') <' and --verbose'>)} { (DQ <'\n'> <'\t\tgit -c commit.verbose='> ($ Id.VSub_DollarName '$i') <' commit --amend --verbose &&\n'> <'\t\ttest_line_count = 1 out\n'> <'\t'> ) } ) (C {<test_expect_success>} {(DQ <'commit.verbose='> ($ Id.VSub_DollarName '$i') <' and --no-verbose'>)} { (DQ <'\n'> <'\t\tgit -c commit.verbose='> ($ Id.VSub_DollarName '$i') <' commit --amend --no-verbose &&\n'> <'\t\ttest_line_count = 0 out\n'> <'\t'> ) } ) (C {<test_expect_success>} {(DQ <'commit.verbose='> ($ Id.VSub_DollarName '$i') <' and -v -v'>)} { (DQ <'\n'> <'\t\tgit -c commit.verbose='> ($ Id.VSub_DollarName '$i') <' commit --amend -v -v &&\n'> <'\t\ttest_line_count = 2 out\n'> <'\t'> ) } ) ] ) ) (C {<test_expect_success>} {(DQ <'status ignores commit.verbose=true'>)} { (SQ <'\n'> <'\tgit -c commit.verbose=true status >actual &&\n'> <'\t! grep "^diff --git actual"\n'> ) } ) (C {<test_done>}) ] )