(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) 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_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[55])] ) ] negated: True ) ] action: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:vi) op:Equal rhs:{(SQ )} spids:[61])] spids: [61] ) ] spids: [-1 58] ) ] spids: [-1 63] ) (ForEach iter_name: i iter_words: [{(GIT_EDITOR)} {(core_editor)} {(EDITOR)} {(VISUAL)} {($ VSub_Name "$vi")}] do_arg_iter: False body: (DoGroup children: [ (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(e-) ($ VSub_Name "$i") (.sh)} spids: [87] ) (HereDoc op_id: Redir_DLessDash fd: -1 body: { (DQ ("#!") ($ 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") ) } do_expansion: True here_end: EOF was_filled: True spids: [92] ) ] ) (C {(chmod)} {(Lit_Other "+") (x)} {(e-) ($ VSub_Name "$i") (.sh)}) ] spids: [82 119] ) spids: [71 -1] ) (If arms: [ (if_arm cond: [(Pipeline children:[(C {(test)} {(-z)} {(DQ ($ VSub_Name "$vi"))})] negated:True)] action: [(C {(mv)} {(e-) ($ VSub_Name "$vi") (.sh)} {($ VSub_Name "$vi")})] spids: [-1 134] ) ] spids: [-1 145] ) (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) op:Equal rhs:{(dumb)} spids:[164])] spids: [164] ) (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) op:Equal rhs:{(vt100)} spids:[208])] spids: [208] ) (C {(export)} {(TERM)}) (ForEach iter_name: i iter_words: [{($ VSub_Name "$vi")} {(EDITOR)} {(VISUAL)} {(core_editor)} {(GIT_EDITOR)}] do_arg_iter: False body: (DoGroup children: [ (SimpleCommand words: [{(echo)} {(DQ ("Edited by ") ($ VSub_Name "$i"))}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(expect)} spids:[241])] ) (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: [272 273 285 -1] ) (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: [288 292 310 -1] ) ] spids: [263 269 313] ) (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: [231 332] ) spids: [220 -1] ) (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: False body: (DoGroup children: [ (SimpleCommand words: [{(echo)} {(DQ ("Edited by ") ($ VSub_Name "$i"))}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(expect)} spids:[377])] ) (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: [390 391 403 -1] ) (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: [406 410 428 -1] ) ] spids: [381 387 431] ) (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: [367 451] ) spids: [356 -1] ) (If arms: [ (if_arm cond: [ (SimpleCommand words: [{(echo)} {(SQ <"echo space > \"$1\"">)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(DQ ("e space.sh"))} spids:[462])] ) ] action: [(C {(test_set_prereq)} {(SPACES_IN_FILENAMES)})] spids: [-1 468] ) ] spids: [-1 479] ) (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)}) ] )