(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'test_description='> name:test_description) op: assign_op.Equal rhs: {(SQ <'GIT_EDITOR, core.editor, and stuff'>)} spids: [4] ) ] redirects: [] ) (C {<.>} {<'./test-lib.sh'>}) (C {<unset>} {<EDITOR>} {<VISUAL>} {<GIT_EDITOR>}) (C {<test_expect_success>} {(SQ <'determine default editor'>)} {(SQ <'\n'> <'\n'> <'\tvi=$(TERM=vt100 git var GIT_EDITOR) &&\n'> <'\ttest -n "$vi"\n'> <'\n'>)} ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Pipeline children: [ (command.Simple words: [ {<expr>} {(DQ ($ Id.VSub_DollarName vi))} {<Id.Lit_Colon ':'>} {(SQ <'[a-z]*$'>)} ] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<'/dev/null'>} ) ] more_env: [] do_fork: T ) ] negated: T stderr_indices: [] ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'vi='> name:vi) op: assign_op.Equal rhs: (rhs_word.Empty) spids: [61] ) ] redirects: [] ) ] spids: [39 58] ) ] else_action: [] redirects: [] ) (command.ForEach iter_names: [i] iterable: (for_iter.Words words: [{<GIT_EDITOR>} {<core_editor>} {<EDITOR>} {<VISUAL>} {($ Id.VSub_DollarName vi)}] ) body: (command.DoGroup children: [ (command.Simple words: [{<cat>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<e-> ($ Id.VSub_DollarName i) <.sh>} ) (redir op: <Id.Redir_DLessDash '<<-'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<EOF>} here_end_span_id: 110 stdin_parts: [ <'#!'> ($ Id.VSub_DollarName SHELL_PATH) <'\n'> <'echo '> <Id.Right_DoubleQuote '"'> <'Edited by '> ($ Id.VSub_DollarName i) <Id.Right_DoubleQuote '"'> <' >'> <Id.Right_DoubleQuote '"'> (word_part.EscapedLiteral token: <Id.Lit_EscapedChar '\\$'> ch: '$' ) <1> <Id.Right_DoubleQuote '"'> <'\n'> ] ) ) ] more_env: [] do_fork: T ) (C {<chmod>} {<Id.Lit_Other '+'> <x>} {<e-> ($ Id.VSub_DollarName i) <.sh>}) ] ) redirects: [] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Pipeline children: [(C {<test>} {<-z>} {(DQ ($ Id.VSub_DollarName vi))})] negated: T stderr_indices: [] ) ] ) action: [(C {<mv>} {<e-> ($ Id.VSub_DollarName vi) <.sh>} {($ Id.VSub_DollarName vi)})] spids: [124 136] ) ] else_action: [] redirects: [] ) (C {<test_expect_success>} {<setup>} { (SQ <'\n'> <'\n'> <'\tmsg="Hand-edited" &&\n'> <'\ttest_commit "$msg" &&\n'> <'\techo "$msg" >expect &&\n'> <'\tgit show -s --format=%s > actual &&\n'> <'\ttest_cmp actual expect\n'> <'\n'> ) } ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'TERM='> name:TERM) op: assign_op.Equal rhs: {<dumb>} spids: [166] ) ] redirects: [] ) (C {<export>} {<TERM>}) (C {<test_expect_success>} {(SQ <'dumb should error out when falling back on vi'>)} { (SQ <'\n'> <'\n'> <'\tif git commit --amend\n'> <'\tthen\n'> <'\t\techo "Oops?"\n'> <'\t\tfalse\n'> <'\telse\n'> <'\t\t: happy\n'> <'\tfi\n'> ) } ) (C {<test_expect_success>} {(SQ <'dumb should prefer EDITOR to VISUAL'>)} { (SQ <'\n'> <'\n'> <'\tEDITOR=./e-EDITOR.sh &&\n'> <'\tVISUAL=./e-VISUAL.sh &&\n'> <'\texport EDITOR VISUAL &&\n'> <'\tgit commit --amend &&\n'> <'\ttest "$(git show -s --format=%s)" = "Edited by EDITOR"\n'> <'\n'> ) } ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'TERM='> name:TERM) op: assign_op.Equal rhs: {<vt100>} spids: [210] ) ] redirects: [] ) (C {<export>} {<TERM>}) (command.ForEach iter_names: [i] iterable: (for_iter.Words words: [{($ Id.VSub_DollarName vi)} {<EDITOR>} {<VISUAL>} {<core_editor>} {<GIT_EDITOR>}] ) body: (command.DoGroup children: [ (command.Simple words: [{<echo>} {(DQ <'Edited by '> ($ Id.VSub_DollarName i))}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expect>})] more_env: [] do_fork: T ) (C {<unset>} {<EDITOR>} {<VISUAL>} {<GIT_EDITOR>}) (C {<git>} {<config>} {<--unset-all>} {<core.editor>}) (command.Case to_match: {(DQ ($ Id.VSub_DollarName i))} arms: [ (case_arm pat_list: [{<core_editor>}] action: [(C {<git>} {<config>} {<core.editor>} {<'./e-core_editor.sh'>})] spids: [274 275 287 -1] ) (case_arm pat_list: [{<Id.Lit_LBracket '['> <A-Z> <Id.Lit_RBracket ']'> <Id.Lit_Star '*'>}] action: [ (C {<eval>} {(DQ ($ Id.VSub_DollarName i) <'=./e-'> ($ Id.VSub_DollarName i) <.sh>)}) (C {<export>} {($ Id.VSub_DollarName i)}) ] spids: [290 294 312 -1] ) ] redirects: [] ) (C {<test_expect_success>} {(DQ <'Using '> ($ Id.VSub_DollarName i))} { (SQ <'\n'> <'\t\tgit --exec-path=. commit --amend &&\n'> <'\t\tgit show -s --pretty=oneline |\n'> <'\t\tsed -e "s/^[0-9a-f]* //" >actual &&\n'> <'\t\ttest_cmp actual expect\n'> <'\t'> ) } ) ] ) redirects: [] ) (C {<unset>} {<EDITOR>} {<VISUAL>} {<GIT_EDITOR>}) (C {<git>} {<config>} {<--unset-all>} {<core.editor>}) (command.ForEach iter_names: [i] iterable: (for_iter.Words words: [{($ Id.VSub_DollarName vi)} {<EDITOR>} {<VISUAL>} {<core_editor>} {<GIT_EDITOR>}] ) body: (command.DoGroup children: [ (command.Simple words: [{<echo>} {(DQ <'Edited by '> ($ Id.VSub_DollarName i))}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expect>})] more_env: [] do_fork: T ) (command.Case to_match: {(DQ ($ Id.VSub_DollarName i))} arms: [ (case_arm pat_list: [{<core_editor>}] action: [(C {<git>} {<config>} {<core.editor>} {<'./e-core_editor.sh'>})] spids: [392 393 405 -1] ) (case_arm pat_list: [{<Id.Lit_LBracket '['> <A-Z> <Id.Lit_RBracket ']'> <Id.Lit_Star '*'>}] action: [ (C {<eval>} {(DQ ($ Id.VSub_DollarName i) <'=./e-'> ($ Id.VSub_DollarName i) <.sh>)}) (C {<export>} {($ Id.VSub_DollarName i)}) ] spids: [408 412 430 -1] ) ] redirects: [] ) (C {<test_expect_success>} {(DQ <'Using '> ($ Id.VSub_DollarName i) <' (override)'>)} { (SQ <'\n'> <'\t\tgit --exec-path=. commit --amend &&\n'> <'\t\tgit show -s --pretty=oneline |\n'> <'\t\tsed -e "s/^[0-9a-f]* //" >actual &&\n'> <'\t\ttest_cmp actual expect\n'> <'\t'> ) } ) ] ) redirects: [] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Simple words: [{<echo>} {(SQ <'echo space > "$1"'>)}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {(DQ <'e space.sh'>)} ) ] more_env: [] do_fork: T ) ] ) action: [(C {<test_set_prereq>} {<SPACES_IN_FILENAMES>})] spids: [456 470] ) ] else_action: [] redirects: [] ) (C {<test_expect_success>} {<SPACES_IN_FILENAMES>} {(SQ <'editor with a space'>)} { (SQ <'\n'> <'\n'> <'\tchmod a+x "e space.sh" &&\n'> <'\tGIT_EDITOR="./e\\ space.sh" git commit --amend &&\n'> <'\ttest space = "$(git show -s --pretty=format:%s)"\n'> <'\n'> ) } ) (C {<unset>} {<GIT_EDITOR>}) (C {<test_expect_success>} {<SPACES_IN_FILENAMES>} {(SQ <'core.editor with a space'>)} { (SQ <'\n'> <'\n'> <'\tgit config core.editor \\"./e\\ space.sh\\" &&\n'> <'\tgit commit --amend &&\n'> <'\ttest space = "$(git show -s --pretty=format:%s)"\n'> <'\n'> ) } ) (C {<test_done>}) ] )