(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <'auto squash'>)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (C {(.)} {(DQ ($ VSub_Name '$TEST_DIRECTORY')) (/lib-rebase.sh)}) (C {(test_expect_success)} {(setup)} { (SQ <'\n'> <'\techo 0 >file0 &&\n'> <'\tgit add . &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m "initial commit" &&\n'> <'\techo 0 >file1 &&\n'> <'\techo 2 >file2 &&\n'> <'\tgit add . &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m "first commit" &&\n'> <'\tgit tag first-commit &&\n'> <'\techo 3 >file3 &&\n'> <'\tgit add . &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m "second commit" &&\n'> <'\tgit tag base\n'> ) } ) (FuncDef name: test_auto_fixup body: (BraceGroup children: [ (AndOr ops: [ Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp ] children: [ (C {(git)} {(reset)} {(--hard)} {(base)}) (SimpleCommand words: [{(echo)} {(1)}] redirects: [(Redir op_id:Redir_Great fd:16777215 arg_word:{(file1)} spids:[70])] ) (C {(git)} {(add)} {(-u)}) (C {(test_tick)}) (C {(git)} {(commit)} {(-m)} {(DQ ('fixup! first'))}) (C {(git)} {(tag)} {($ VSub_Number '$1')}) (C {(test_tick)}) (C {(git)} {(rebase)} {($ VSub_Number '$2')} {(-i)} {(HEAD) (Lit_Other '^') (Lit_Other '^') (Lit_Other '^')} ) (SimpleCommand words: [{(git)} {(log)} {(--oneline)}] redirects: [(Redir op_id:Redir_Great fd:16777215 arg_word:{(actual)} spids:[140])] ) (C {(test_line_count)} {(Lit_Other '=')} {(3)} {(actual)}) (C {(git)} {(diff)} {(--exit-code)} {($ VSub_Number '$1')}) (C {(test)} {(1)} {(Lit_Other '=')} { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(git)} {(cat-file)} {(blob)} {(HEAD) (Lit_Other '^') (Lit_Other ':') (file1)} ) ] ) left_token: <Left_CommandSub '$('> spids: [175 186] ) ) } ) (C {(test)} {(1)} {(Lit_Other '=')} { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(git)} {(cat-file)} {(commit)} {(HEAD) (Lit_Other '^')}) (C {(grep)} {(first)}) (C {(wc)} {(-l)}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> spids: [198 219] ) } ) ] ) ] spids: [52] ) spids: [47 51] ) (C {(test_expect_success)} {(SQ <'auto fixup (option)'>)} {(SQ <'\n'> <'\ttest_auto_fixup final-fixup-option --autosquash\n'>)} ) (C {(test_expect_success)} {(SQ <'auto fixup (config)'>)} { (SQ <'\n'> <'\tgit config rebase.autosquash true &&\n'> <'\ttest_auto_fixup final-fixup-config-true &&\n'> <'\ttest_must_fail test_auto_fixup fixup-config-true-no --no-autosquash &&\n'> <'\tgit config rebase.autosquash false &&\n'> <'\ttest_must_fail test_auto_fixup final-fixup-config-false\n'> ) } ) (FuncDef name: test_auto_squash body: (BraceGroup children: [ (AndOr ops: [ Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp ] children: [ (C {(git)} {(reset)} {(--hard)} {(base)}) (SimpleCommand words: [{(echo)} {(1)}] redirects: [(Redir op_id:Redir_Great fd:16777215 arg_word:{(file1)} spids:[275])] ) (C {(git)} {(add)} {(-u)}) (C {(test_tick)}) (C {(git)} {(commit)} {(-m)} {(DQ ('squash! first'))}) (C {(git)} {(tag)} {($ VSub_Number '$1')}) (C {(test_tick)}) (C {(git)} {(rebase)} {($ VSub_Number '$2')} {(-i)} {(HEAD) (Lit_Other '^') (Lit_Other '^') (Lit_Other '^')} ) (SimpleCommand words: [{(git)} {(log)} {(--oneline)}] redirects: [(Redir op_id:Redir_Great fd:16777215 arg_word:{(actual)} spids:[345])] ) (C {(test_line_count)} {(Lit_Other '=')} {(3)} {(actual)}) (C {(git)} {(diff)} {(--exit-code)} {($ VSub_Number '$1')}) (C {(test)} {(1)} {(Lit_Other '=')} { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(git)} {(cat-file)} {(blob)} {(HEAD) (Lit_Other '^') (Lit_Other ':') (file1)} ) ] ) left_token: <Left_CommandSub '$('> spids: [380 391] ) ) } ) (C {(test)} {(2)} {(Lit_Other '=')} { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(git)} {(cat-file)} {(commit)} {(HEAD) (Lit_Other '^')}) (C {(grep)} {(first)}) (C {(wc)} {(-l)}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> spids: [403 424] ) } ) ] ) ] spids: [257] ) spids: [252 256] ) (C {(test_expect_success)} {(SQ <'auto squash (option)'>)} {(SQ <'\n'> <'\ttest_auto_squash final-squash --autosquash\n'>)} ) (C {(test_expect_success)} {(SQ <'auto squash (config)'>)} { (SQ <'\n'> <'\tgit config rebase.autosquash true &&\n'> <'\ttest_auto_squash final-squash-config-true &&\n'> <'\ttest_must_fail test_auto_squash squash-config-true-no --no-autosquash &&\n'> <'\tgit config rebase.autosquash false &&\n'> <'\ttest_must_fail test_auto_squash final-squash-config-false\n'> ) } ) (C {(test_expect_success)} {(SQ <'misspelled auto squash'>)} { (SQ <'\n'> <'\tgit reset --hard base &&\n'> <'\techo 1 >file1 &&\n'> <'\tgit add -u &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m "squash! forst" &&\n'> <'\tgit tag final-missquash &&\n'> <'\ttest_tick &&\n'> <'\tgit rebase --autosquash -i HEAD^^^ &&\n'> <'\tgit log --oneline >actual &&\n'> <'\ttest_line_count = 4 actual &&\n'> <'\tgit diff --exit-code final-missquash &&\n'> <'\ttest 0 = $(git rev-list final-missquash...HEAD | wc -l)\n'> ) } ) (C {(test_expect_success)} {(SQ <'auto squash that matches 2 commits'>)} { (SQ <'\n'> <'\tgit reset --hard base &&\n'> <'\techo 4 >file4 &&\n'> <'\tgit add file4 &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m "first new commit" &&\n'> <'\techo 1 >file1 &&\n'> <'\tgit add -u &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m "squash! first" &&\n'> <'\tgit tag final-multisquash &&\n'> <'\ttest_tick &&\n'> <'\tgit rebase --autosquash -i HEAD~4 &&\n'> <'\tgit log --oneline >actual &&\n'> <'\ttest_line_count = 4 actual &&\n'> <'\tgit diff --exit-code final-multisquash &&\n'> <'\ttest 1 = "$(git cat-file blob HEAD^^:file1)" &&\n'> <'\ttest 2 = $(git cat-file commit HEAD^^ | grep first | wc -l) &&\n'> <'\ttest 1 = $(git cat-file commit HEAD | grep first | wc -l)\n'> ) } ) (C {(test_expect_success)} {(SQ <'auto squash that matches a commit after the squash'>)} { (SQ <'\n'> <'\tgit reset --hard base &&\n'> <'\techo 1 >file1 &&\n'> <'\tgit add -u &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m "squash! third" &&\n'> <'\techo 4 >file4 &&\n'> <'\tgit add file4 &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m "third commit" &&\n'> <'\tgit tag final-presquash &&\n'> <'\ttest_tick &&\n'> <'\tgit rebase --autosquash -i HEAD~4 &&\n'> <'\tgit log --oneline >actual &&\n'> <'\ttest_line_count = 5 actual &&\n'> <'\tgit diff --exit-code final-presquash &&\n'> <'\ttest 0 = "$(git cat-file blob HEAD^^:file1)" &&\n'> <'\ttest 1 = "$(git cat-file blob HEAD^:file1)" &&\n'> <'\ttest 1 = $(git cat-file commit HEAD | grep third | wc -l) &&\n'> <'\ttest 1 = $(git cat-file commit HEAD^ | grep third | wc -l)\n'> ) } ) (C {(test_expect_success)} {(SQ <'auto squash that matches a sha1'>)} { (SQ <'\n'> <'\tgit reset --hard base &&\n'> <'\techo 1 >file1 &&\n'> <'\tgit add -u &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m "squash! $(git rev-parse --short HEAD^)" &&\n'> <'\tgit tag final-shasquash &&\n'> <'\ttest_tick &&\n'> <'\tgit rebase --autosquash -i HEAD^^^ &&\n'> <'\tgit log --oneline >actual &&\n'> <'\ttest_line_count = 3 actual &&\n'> <'\tgit diff --exit-code final-shasquash &&\n'> <'\ttest 1 = "$(git cat-file blob HEAD^:file1)" &&\n'> <'\ttest 1 = $(git cat-file commit HEAD^ | grep squash | wc -l)\n'> ) } ) (C {(test_expect_success)} {(SQ <'auto squash that matches longer sha1'>)} { (SQ <'\n'> <'\tgit reset --hard base &&\n'> <'\techo 1 >file1 &&\n'> <'\tgit add -u &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m "squash! $(git rev-parse --short=11 HEAD^)" &&\n'> <'\tgit tag final-longshasquash &&\n'> <'\ttest_tick &&\n'> <'\tgit rebase --autosquash -i HEAD^^^ &&\n'> <'\tgit log --oneline >actual &&\n'> <'\ttest_line_count = 3 actual &&\n'> <'\tgit diff --exit-code final-longshasquash &&\n'> <'\ttest 1 = "$(git cat-file blob HEAD^:file1)" &&\n'> <'\ttest 1 = $(git cat-file commit HEAD^ | grep squash | wc -l)\n'> ) } ) (FuncDef name: test_auto_commit_flags body: (BraceGroup children: [ (AndOr ops: [ Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp ] children: [ (C {(git)} {(reset)} {(--hard)} {(base)}) (SimpleCommand words: [{(echo)} {(1)}] redirects: [(Redir op_id:Redir_Great fd:16777215 arg_word:{(file1)} spids:[609])] ) (C {(git)} {(add)} {(-u)}) (C {(test_tick)}) (C {(git)} {(commit)} {(--) ($ VSub_Number '$1')} {(first-commit)}) (C {(git)} {(tag)} {(final-commit-) ($ VSub_Number '$1')}) (C {(test_tick)}) (C {(git)} {(rebase)} {(--autosquash)} {(-i)} {(HEAD) (Lit_Other '^') (Lit_Other '^') (Lit_Other '^')} ) (SimpleCommand words: [{(git)} {(log)} {(--oneline)}] redirects: [(Redir op_id:Redir_Great fd:16777215 arg_word:{(actual)} spids:[678])] ) (C {(test_line_count)} {(Lit_Other '=')} {(3)} {(actual)}) (C {(git)} {(diff)} {(--exit-code)} {(final-commit-) ($ VSub_Number '$1')}) (C {(test)} {(1)} {(Lit_Other '=')} { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(git)} {(cat-file)} {(blob)} {(HEAD) (Lit_Other '^') (Lit_Other ':') (file1)} ) ] ) left_token: <Left_CommandSub '$('> spids: [714 725] ) ) } ) (C {(test)} {($ VSub_Number '$2')} {(Lit_Other '=')} { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(git)} {(cat-file)} {(commit)} {(HEAD) (Lit_Other '^')}) (C {(grep)} {(first)}) (C {(wc)} {(-l)}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> spids: [737 758] ) } ) ] ) ] spids: [591] ) spids: [586 590] ) (C {(test_expect_success)} {(SQ <'use commit --fixup'>)} {(SQ <'\n'> <'\ttest_auto_commit_flags fixup 1\n'>)} ) (C {(test_expect_success)} {(SQ <'use commit --squash'>)} {(SQ <'\n'> <'\ttest_auto_commit_flags squash 2\n'>)} ) (FuncDef name: test_auto_fixup_fixup body: (BraceGroup children: [ (AndOr ops: [ Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp ] children: [ (C {(git)} {(reset)} {(--hard)} {(base)}) (SimpleCommand words: [{(echo)} {(1)}] redirects: [(Redir op_id:Redir_Great fd:16777215 arg_word:{(file1)} spids:[810])] ) (C {(git)} {(add)} {(-u)}) (C {(test_tick)}) (C {(git)} {(commit)} {(-m)} {(DQ ($ VSub_Number '$1') ('! first'))}) (SimpleCommand words: [{(echo)} {(2)}] redirects: [(Redir op_id:Redir_Great fd:16777215 arg_word:{(file1)} spids:[848])] ) (C {(git)} {(add)} {(-u)}) (C {(test_tick)}) (C {(git)} {(commit)} {(-m)} {(DQ ($ VSub_Number '$1') ('! ') ($ VSub_Number '$2') ('! first'))} ) (C {(git)} {(tag)} {(DQ (final-) ($ VSub_Number '$1') (-) ($ VSub_Number '$2'))}) (C {(test_tick)}) (Subshell child: (AndOr ops: [Op_DAmp Op_DAmp Op_DAmp] children: [ (C {(set_cat_todo_editor)}) (SimpleCommand words: [ {(test_must_fail)} {(git)} {(rebase)} {(--autosquash)} {(-i)} {(HEAD) (Lit_Other '^') (Lit_Other '^') (Lit_Other '^') (Lit_Other '^')} ] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(actual)} spids: [927] ) ] ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(expected)} spids: [935] ) (HereDoc op_id: Redir_DLessDash fd: 16777215 body: { (DQ ('pick ') (CommandSubPart command_list: (CommandList children: [ (C {(git)} {(rev-parse)} {(--short)} {(HEAD) (Lit_Other '^') (Lit_Other '^') (Lit_Other '^')} ) ] ) left_token: <Left_CommandSub '$('> spids: [944 955] ) (' first commit\n') ($ VSub_Number '$1') (' ') (CommandSubPart command_list: (CommandList children: [ (C {(git)} {(rev-parse)} {(--short)} {(HEAD) (Lit_Other '^')}) ] ) left_token: <Left_CommandSub '$('> spids: [959 968] ) (' ') ($ VSub_Number '$1') ('! first\n') ($ VSub_Number '$1') (' ') (CommandSubPart command_list: (CommandList children: [(C {(git)} {(rev-parse)} {(--short)} {(HEAD)})] ) left_token: <Left_CommandSub '$('> spids: [974 982] ) (' ') ($ VSub_Number '$1') ('! ') ($ VSub_Number '$2') ('! first\n') ('pick ') (CommandSubPart command_list: (CommandList children: [ (C {(git)} {(rev-parse)} {(--short)} {(HEAD) (Lit_Other '^') (Lit_Other '^')} ) ] ) left_token: <Left_CommandSub '$('> spids: [989 999] ) (' second commit\n') ) } do_expansion: True here_end: EOF was_filled: T spids: [938] ) ] ) (C {(test_cmp)} {(expected)} {(actual)}) ] ) spids: [903 1010] ) (C {(git)} {(rebase)} {(--autosquash)} {(-i)} {(HEAD) (Lit_Other '^') (Lit_Other '^') (Lit_Other '^') (Lit_Other '^')} ) (SimpleCommand words: [{(git)} {(log)} {(--oneline)}] redirects: [(Redir op_id:Redir_Great fd:16777215 arg_word:{(actual)} spids:[1038])] ) (C {(test_line_count)} {(Lit_Other '=')} {(3)} {(actual)}) ] ) (AndOr ops: [Op_DAmp Op_DAmp] children: [ (C {(git)} {(diff)} {(--exit-code)} {(DQ (final-) ($ VSub_Number '$1') (-) ($ VSub_Number '$2'))} ) (C {(test)} {(2)} {(Lit_Other '=')} { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(git)} {(cat-file)} {(blob)} {(HEAD) (Lit_Other '^') (Lit_Other ':') (file1)} ) ] ) left_token: <Left_CommandSub '$('> spids: [1076 1087] ) ) } ) (If arms: [ (if_arm cond: [(C {(test)} {(DQ ($ VSub_Number '$1'))} {(Lit_Other '=')} {(DQ (fixup))})] action: [ (C {(test)} {(1)} {(Lit_Other '=')} { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(git)} {(cat-file)} {(commit)} {(HEAD) (Lit_Other '^')}) (C {(grep)} {(first)}) (C {(wc)} {(-l)}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> spids: [1117 1138] ) } ) ] spids: [16777215 1108] ) (if_arm cond: [(C {(test)} {(DQ ($ VSub_Number '$1'))} {(Lit_Other '=')} {(DQ (squash))})] action: [ (C {(test)} {(3)} {(Lit_Other '=')} { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(git)} {(cat-file)} {(commit)} {(HEAD) (Lit_Other '^')}) (C {(grep)} {(first)}) (C {(wc)} {(-l)}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> spids: [1165 1186] ) } ) ] spids: [1141 1156] ) ] else_action: [(C {(false)})] spids: [1189 1195] ) ] ) ] spids: [792] ) spids: [787 791] ) (C {(test_expect_success)} {(SQ <'fixup! fixup!'>)} {(SQ <'\n'> <'\ttest_auto_fixup_fixup fixup fixup\n'>)} ) (C {(test_expect_success)} {(SQ <'fixup! squash!'>)} {(SQ <'\n'> <'\ttest_auto_fixup_fixup fixup squash\n'>)} ) (C {(test_expect_success)} {(SQ <'squash! squash!'>)} {(SQ <'\n'> <'\ttest_auto_fixup_fixup squash squash\n'>)} ) (C {(test_expect_success)} {(SQ <'squash! fixup!'>)} {(SQ <'\n'> <'\ttest_auto_fixup_fixup squash fixup\n'>)} ) (C {(test_expect_success)} {(SQ <'autosquash with custom inst format'>)} { (SQ <'\n'> <'\tgit reset --hard base &&\n'> <'\tgit config --add rebase.instructionFormat "[%an @ %ar] %s" &&\n'> <'\techo 2 >file1 &&\n'> <'\tgit add -u &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m "squash! $(git rev-parse --short HEAD^)" &&\n'> <'\techo 1 >file1 &&\n'> <'\tgit add -u &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m "squash! $(git log -n 1 --format=%s HEAD~2)" &&\n'> <'\tgit tag final-squash-instFmt &&\n'> <'\ttest_tick &&\n'> <'\tgit rebase --autosquash -i HEAD~4 &&\n'> <'\tgit log --oneline >actual &&\n'> <'\ttest_line_count = 3 actual &&\n'> <'\tgit diff --exit-code final-squash-instFmt &&\n'> <'\ttest 1 = "$(git cat-file blob HEAD^:file1)" &&\n'> <'\ttest 2 = $(git cat-file commit HEAD^ | grep squash | wc -l)\n'> ) } ) (FuncDef name: set_backup_editor body: (BraceGroup children: [ (SimpleCommand words: [{(write_script)} {(backup-editor.sh)}] redirects: [ (HereDoc op_id: Redir_DLessDash fd: 16777215 body: {('cp "$1" .git/backup-"$(basename "$1")"\n')} do_expansion: False here_end: EOF was_filled: T spids: [1289] ) ] ) (C {(test_set_editor)} {(DQ ($ VSub_Name '$PWD') (/backup-editor.sh))}) ] spids: [1282] ) spids: [1277 1281] ) (C {(test_expect_failure)} {(SQ <'autosquash with multiple empty patches'>)} { (SQ <'\n'> <'\ttest_tick &&\n'> <'\tgit commit --allow-empty -m "empty" &&\n'> <'\ttest_tick &&\n'> <'\tgit commit --allow-empty -m "empty2" &&\n'> <'\ttest_tick &&\n'> <'\t>fixup &&\n'> <'\tgit add fixup &&\n'> <'\tgit commit --fixup HEAD^^ &&\n'> <'\t(\n'> <'\t\tset_backup_editor &&\n'> <'\t\tGIT_USE_REBASE_HELPER=false \\\n'> <'\t\tgit rebase -i --force-rebase --autosquash HEAD~4 &&\n'> <'\t\tgrep empty2 .git/backup-git-rebase-todo\n'> <'\t)\n'> ) } ) (C {(test_expect_success)} {(SQ <'extra spaces after fixup!'>)} { (SQ <'\n'> <'\tbase=$(git rev-parse HEAD) &&\n'> <'\ttest_commit to-fixup &&\n'> <'\tgit commit --allow-empty -m "fixup! to-fixup" &&\n'> <'\tgit rebase -i --autosquash --keep-empty HEAD~2 &&\n'> <'\tparent=$(git rev-parse HEAD^) &&\n'> <'\ttest $base = $parent\n'> ) } ) (C {(test_done)}) ] )