(command.CommandList children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:test_description) op: Equal rhs: {(SQ <'auto squash'>)} ) ] ) (C {(.)} {(./test-lib.sh)}) (C {(.)} {(DQ ($ VSub_DollarName '$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'> ) } ) (command.FuncDef name: test_auto_fixup body: (command.BraceGroup children: [ (command.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)}) (command.SimpleCommand words: [{(echo)} {(1)}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(file1)})] ) (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 '^')} ) (command.SimpleCommand words: [{(git)} {(log)} {(--oneline)}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(actual)})] ) (C {(test_line_count)} {(Lit_Other '=')} {(3)} {(actual)}) (C {(git)} {(diff)} {(--exit-code)} {($ VSub_Number '$1')}) (C {(test)} {(1)} {(Lit_Other '=')} { (DQ (word_part.CommandSubPart command_list: (command.CommandList children: [ (C {(git)} {(cat-file)} {(blob)} {(HEAD) (Lit_Other '^') (Lit_Other ':') (file1)} ) ] ) left_token: <Left_CommandSub '$('> ) ) } ) (C {(test)} {(1)} {(Lit_Other '=')} { (word_part.CommandSubPart command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(git)} {(cat-file)} {(commit)} {(HEAD) (Lit_Other '^')}) (C {(grep)} {(first)}) (C {(wc)} {(-l)}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> ) } ) ] ) ] ) ) (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'> ) } ) (command.FuncDef name: test_auto_squash body: (command.BraceGroup children: [ (command.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)}) (command.SimpleCommand words: [{(echo)} {(1)}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(file1)})] ) (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 '^')} ) (command.SimpleCommand words: [{(git)} {(log)} {(--oneline)}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(actual)})] ) (C {(test_line_count)} {(Lit_Other '=')} {(3)} {(actual)}) (C {(git)} {(diff)} {(--exit-code)} {($ VSub_Number '$1')}) (C {(test)} {(1)} {(Lit_Other '=')} { (DQ (word_part.CommandSubPart command_list: (command.CommandList children: [ (C {(git)} {(cat-file)} {(blob)} {(HEAD) (Lit_Other '^') (Lit_Other ':') (file1)} ) ] ) left_token: <Left_CommandSub '$('> ) ) } ) (C {(test)} {(2)} {(Lit_Other '=')} { (word_part.CommandSubPart command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(git)} {(cat-file)} {(commit)} {(HEAD) (Lit_Other '^')}) (C {(grep)} {(first)}) (C {(wc)} {(-l)}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> ) } ) ] ) ] ) ) (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'> ) } ) (command.FuncDef name: test_auto_commit_flags body: (command.BraceGroup children: [ (command.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)}) (command.SimpleCommand words: [{(echo)} {(1)}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(file1)})] ) (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 '^')} ) (command.SimpleCommand words: [{(git)} {(log)} {(--oneline)}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(actual)})] ) (C {(test_line_count)} {(Lit_Other '=')} {(3)} {(actual)}) (C {(git)} {(diff)} {(--exit-code)} {(final-commit-) ($ VSub_Number '$1')}) (C {(test)} {(1)} {(Lit_Other '=')} { (DQ (word_part.CommandSubPart command_list: (command.CommandList children: [ (C {(git)} {(cat-file)} {(blob)} {(HEAD) (Lit_Other '^') (Lit_Other ':') (file1)} ) ] ) left_token: <Left_CommandSub '$('> ) ) } ) (C {(test)} {($ VSub_Number '$2')} {(Lit_Other '=')} { (word_part.CommandSubPart command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(git)} {(cat-file)} {(commit)} {(HEAD) (Lit_Other '^')}) (C {(grep)} {(first)}) (C {(wc)} {(-l)}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> ) } ) ] ) ] ) ) (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'>)} ) (command.FuncDef name: test_auto_fixup_fixup body: (command.BraceGroup children: [ (command.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)}) (command.SimpleCommand words: [{(echo)} {(1)}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(file1)})] ) (C {(git)} {(add)} {(-u)}) (C {(test_tick)}) (C {(git)} {(commit)} {(-m)} {(DQ ($ VSub_Number '$1') ('! first'))}) (command.SimpleCommand words: [{(echo)} {(2)}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(file1)})] ) (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)}) (command.Subshell command_list: (command.CommandList children: [ (command.AndOr ops: [Op_DAmp Op_DAmp Op_DAmp] children: [ (C {(set_cat_todo_editor)}) (command.SimpleCommand words: [ {(test_must_fail)} {(git)} {(rebase)} {(--autosquash)} {(-i)} {(HEAD) (Lit_Other '^') (Lit_Other '^') (Lit_Other '^') (Lit_Other '^')} ] redirects: [ (redir.Redir op: <Redir_Great '>'> fd: 16777215 arg_word: {(actual)} ) ] ) (command.SimpleCommand words: [{(cat)}] redirects: [ (redir.Redir op: <Redir_Great '>'> fd: 16777215 arg_word: {(expected)} ) (redir.HereDoc op: <Redir_DLessDash '<<-'> fd: 16777215 here_begin: {(EOF)} here_end_span_id: 1002 stdin_parts: [ ('pick ') (word_part.CommandSubPart command_list: (command.CommandList children: [ (C {(git)} {(rev-parse)} {(--short)} {(HEAD) (Lit_Other '^') (Lit_Other '^') (Lit_Other '^')} ) ] ) left_token: <Left_CommandSub '$('> ) (' first commit\n') ($ VSub_Number '$1') (' ') (word_part.CommandSubPart command_list: (command.CommandList children: [ (C {(git)} {(rev-parse)} {(--short)} {(HEAD) (Lit_Other '^')}) ] ) left_token: <Left_CommandSub '$('> ) (' ') ($ VSub_Number '$1') ('! first\n') ($ VSub_Number '$1') (' ') (word_part.CommandSubPart command_list: (command.CommandList children: [(C {(git)} {(rev-parse)} {(--short)} {(HEAD)})] ) left_token: <Left_CommandSub '$('> ) (' ') ($ VSub_Number '$1') ('! ') ($ VSub_Number '$2') ('! first\n') ('pick ') (word_part.CommandSubPart command_list: (command.CommandList children: [ (C {(git)} {(rev-parse)} {(--short)} {(HEAD) (Lit_Other '^') (Lit_Other '^')} ) ] ) left_token: <Left_CommandSub '$('> ) (' second commit\n') ] ) ] ) (C {(test_cmp)} {(expected)} {(actual)}) ] ) ] ) ) (C {(git)} {(rebase)} {(--autosquash)} {(-i)} {(HEAD) (Lit_Other '^') (Lit_Other '^') (Lit_Other '^') (Lit_Other '^')} ) (command.SimpleCommand words: [{(git)} {(log)} {(--oneline)}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(actual)})] ) (C {(test_line_count)} {(Lit_Other '=')} {(3)} {(actual)}) ] ) (command.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 (word_part.CommandSubPart command_list: (command.CommandList children: [ (C {(git)} {(cat-file)} {(blob)} {(HEAD) (Lit_Other '^') (Lit_Other ':') (file1)} ) ] ) left_token: <Left_CommandSub '$('> ) ) } ) (command.If arms: [ (if_arm cond: [(C {(test)} {(DQ ($ VSub_Number '$1'))} {(Lit_Other '=')} {(DQ (fixup))})] action: [ (C {(test)} {(1)} {(Lit_Other '=')} { (word_part.CommandSubPart command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(git)} {(cat-file)} {(commit)} {(HEAD) (Lit_Other '^')}) (C {(grep)} {(first)}) (C {(wc)} {(-l)}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> ) } ) ] ) (if_arm cond: [(C {(test)} {(DQ ($ VSub_Number '$1'))} {(Lit_Other '=')} {(DQ (squash))})] action: [ (C {(test)} {(3)} {(Lit_Other '=')} { (word_part.CommandSubPart command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(git)} {(cat-file)} {(commit)} {(HEAD) (Lit_Other '^')}) (C {(grep)} {(first)}) (C {(wc)} {(-l)}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> ) } ) ] ) ] else_action: [(C {(false)})] ) ] ) ] ) ) (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'> ) } ) (command.FuncDef name: set_backup_editor body: (command.BraceGroup children: [ (command.SimpleCommand words: [{(write_script)} {(backup-editor.sh)}] redirects: [ (redir.HereDoc op: <Redir_DLessDash '<<-'> fd: 16777215 here_begin: {(word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\E'>) (OF)} here_end_span_id: 1295 stdin_parts: [('cp "$1" .git/backup-"$(basename "$1")"\n')] ) ] ) (C {(test_set_editor)} {(DQ ($ VSub_DollarName '$PWD') (/backup-editor.sh))}) ] ) ) (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)}) ] )