(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description spids:[4]) op: Equal rhs: {(SQ <'GIT_EDITOR, core.editor, and stuff'>)} spids: [4] ) ] spids: [4] ) (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'>) } ) (If arms: [ (if_arm cond: [ (Pipeline children: [ (SimpleCommand words: [{(expr)} {(DQ ($ VSub_Name '$vi'))} {(Lit_Other ':')} {(SQ <'[a-z]*$'>)}] redirects: [(Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)})] ) ] negated: T ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:vi spids:[61]) op: Equal rhs: (EmptyWord) spids: [61] ) ] spids: [61] ) ] spids: [16777215 58] ) ] spids: [16777215 63] ) (ForEach iter_name: i iter_words: [{(GIT_EDITOR)} {(core_editor)} {(EDITOR)} {(VISUAL)} {($ VSub_Name '$vi')}] do_arg_iter: F body: (DoGroup children: [ (SimpleCommand words: [{(cat)}] redirects: [ (Redir op: <Redir_Great '>'> fd: 16777215 arg_word: {(e-) ($ VSub_Name '$i') (.sh)} ) (HereDoc op: <Redir_DLessDash '<<-'> fd: 16777215 here_begin: {(EOF)} here_end_span_id: 110 stdin_parts: [ ('#!') ($ VSub_Name '$SHELL_PATH') ('\n') ('echo ') (Right_DoubleQuote '"') ('Edited by ') ($ VSub_Name '$i') (Right_DoubleQuote '"') (' >') (Right_DoubleQuote '"') (EscapedLiteralPart token:<Lit_EscapedChar '\\$'>) (1) (Right_DoubleQuote '"') ('\n') ] ) ] ) (C {(chmod)} {(Lit_Other '+') (x)} {(e-) ($ VSub_Name '$i') (.sh)}) ] spids: [82 121] ) spids: [71 16777215] ) (If arms: [ (if_arm cond: [(Pipeline children:[(C {(test)} {(-z)} {(DQ ($ VSub_Name '$vi'))})] negated:T)] action: [(C {(mv)} {(e-) ($ VSub_Name '$vi') (.sh)} {($ VSub_Name '$vi')})] spids: [16777215 136] ) ] spids: [16777215 147] ) (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'> ) } ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:TERM spids:[166]) op:Equal rhs:{(dumb)} spids:[166])] spids: [166] ) (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'> ) } ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:TERM spids:[210]) op:Equal rhs:{(vt100)} spids:[210])] spids: [210] ) (C {(export)} {(TERM)}) (ForEach iter_name: i iter_words: [{($ VSub_Name '$vi')} {(EDITOR)} {(VISUAL)} {(core_editor)} {(GIT_EDITOR)}] do_arg_iter: F body: (DoGroup children: [ (SimpleCommand words: [{(echo)} {(DQ ('Edited by ') ($ VSub_Name '$i'))}] redirects: [(Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expect)})] ) (C {(unset)} {(EDITOR)} {(VISUAL)} {(GIT_EDITOR)}) (C {(git)} {(config)} {(--unset-all)} {(core.editor)}) (Case to_match: {(DQ ($ VSub_Name '$i'))} arms: [ (case_arm pat_list: [{(core_editor)}] action: [(C {(git)} {(config)} {(core.editor)} {(./e-core_editor.sh)})] spids: [274 275 287 16777215] ) (case_arm pat_list: [{(Lit_Other '[') (A-Z) (Lit_Other ']') (Lit_Other '*')}] action: [ (C {(eval)} {(DQ ($ VSub_Name '$i') ('=./e-') ($ VSub_Name '$i') (.sh))}) (C {(export)} {($ VSub_Name '$i')}) ] spids: [290 294 312 16777215] ) ] spids: [265 271 315] ) (C {(test_expect_success)} {(DQ ('Using ') ($ VSub_Name '$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'> ) } ) ] spids: [233 334] ) spids: [222 16777215] ) (C {(unset)} {(EDITOR)} {(VISUAL)} {(GIT_EDITOR)}) (C {(git)} {(config)} {(--unset-all)} {(core.editor)}) (ForEach iter_name: i iter_words: [{($ VSub_Name '$vi')} {(EDITOR)} {(VISUAL)} {(core_editor)} {(GIT_EDITOR)}] do_arg_iter: F body: (DoGroup children: [ (SimpleCommand words: [{(echo)} {(DQ ('Edited by ') ($ VSub_Name '$i'))}] redirects: [(Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expect)})] ) (Case to_match: {(DQ ($ VSub_Name '$i'))} arms: [ (case_arm pat_list: [{(core_editor)}] action: [(C {(git)} {(config)} {(core.editor)} {(./e-core_editor.sh)})] spids: [392 393 405 16777215] ) (case_arm pat_list: [{(Lit_Other '[') (A-Z) (Lit_Other ']') (Lit_Other '*')}] action: [ (C {(eval)} {(DQ ($ VSub_Name '$i') ('=./e-') ($ VSub_Name '$i') (.sh))}) (C {(export)} {($ VSub_Name '$i')}) ] spids: [408 412 430 16777215] ) ] spids: [383 389 433] ) (C {(test_expect_success)} {(DQ ('Using ') ($ VSub_Name '$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'> ) } ) ] spids: [369 453] ) spids: [358 16777215] ) (If arms: [ (if_arm cond: [ (SimpleCommand words: [{(echo)} {(SQ <'echo space > "$1"'>)}] redirects: [(Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(DQ ('e space.sh'))})] ) ] action: [(C {(test_set_prereq)} {(SPACES_IN_FILENAMES)})] spids: [16777215 470] ) ] spids: [16777215 481] ) (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)}) ] )