(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: {(SQ <'auto squash'>)} spids: [4] ) ] ) (C {<.>} {<'./test-lib.sh'>}) (C {<.>} {(DQ ($ Id.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.ShFunction name: test_auto_fixup body: (BraceGroup children: [ (command.AndOr ops: [ Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp ] children: [ (C {<git>} {<reset>} {<--hard>} {<base>}) (command.Simple words: [{<echo>} {<1>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<file1>})] do_fork: T ) (C {<git>} {<add>} {<-u>}) (C {<test_tick>}) (C {<git>} {<commit>} {<-m>} {(DQ <'fixup! first'>)}) (C {<git>} {<tag>} {($ Id.VSub_Number '$1')}) (C {<test_tick>}) (C {<git>} {<rebase>} {($ Id.VSub_Number '$2')} {<-i>} {<HEAD> <Id.Lit_Other '^'> <Id.Lit_Other '^'> <Id.Lit_Other '^'>} ) (command.Simple words: [{<git>} {<log>} {<--oneline>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<actual>})] do_fork: T ) (C {<test_line_count>} {<Id.Lit_Equals '='>} {<3>} {<actual>}) (C {<git>} {<diff>} {<--exit-code>} {($ Id.VSub_Number '$1')}) (C {<test>} {<1>} {<Id.Lit_Equals '='>} { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<git>} {<cat-file>} {<blob>} {<HEAD> <Id.Lit_Other '^'> <Id.Lit_Colon ':'> <file1>} ) ) ) } ) (C {<test>} {<1>} {<Id.Lit_Equals '='>} { (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.Pipeline children: [ (C {<git>} {<cat-file>} {<commit>} {<HEAD> <Id.Lit_Other '^'>}) (C {<grep>} {<first>}) (C {<wc>} {<-l>}) ] negated: F ) ) } ) ] ) ] ) ) (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.ShFunction name: test_auto_squash body: (BraceGroup children: [ (command.AndOr ops: [ Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp ] children: [ (C {<git>} {<reset>} {<--hard>} {<base>}) (command.Simple words: [{<echo>} {<1>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<file1>})] do_fork: T ) (C {<git>} {<add>} {<-u>}) (C {<test_tick>}) (C {<git>} {<commit>} {<-m>} {(DQ <'squash! first'>)}) (C {<git>} {<tag>} {($ Id.VSub_Number '$1')}) (C {<test_tick>}) (C {<git>} {<rebase>} {($ Id.VSub_Number '$2')} {<-i>} {<HEAD> <Id.Lit_Other '^'> <Id.Lit_Other '^'> <Id.Lit_Other '^'>} ) (command.Simple words: [{<git>} {<log>} {<--oneline>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<actual>})] do_fork: T ) (C {<test_line_count>} {<Id.Lit_Equals '='>} {<3>} {<actual>}) (C {<git>} {<diff>} {<--exit-code>} {($ Id.VSub_Number '$1')}) (C {<test>} {<1>} {<Id.Lit_Equals '='>} { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<git>} {<cat-file>} {<blob>} {<HEAD> <Id.Lit_Other '^'> <Id.Lit_Colon ':'> <file1>} ) ) ) } ) (C {<test>} {<2>} {<Id.Lit_Equals '='>} { (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.Pipeline children: [ (C {<git>} {<cat-file>} {<commit>} {<HEAD> <Id.Lit_Other '^'>}) (C {<grep>} {<first>}) (C {<wc>} {<-l>}) ] negated: F ) ) } ) ] ) ] ) ) (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.ShFunction name: test_auto_commit_flags body: (BraceGroup children: [ (command.AndOr ops: [ Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp ] children: [ (C {<git>} {<reset>} {<--hard>} {<base>}) (command.Simple words: [{<echo>} {<1>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<file1>})] do_fork: T ) (C {<git>} {<add>} {<-u>}) (C {<test_tick>}) (C {<git>} {<commit>} {<--> ($ Id.VSub_Number '$1')} {<first-commit>}) (C {<git>} {<tag>} {<final-commit-> ($ Id.VSub_Number '$1')}) (C {<test_tick>}) (C {<git>} {<rebase>} {<--autosquash>} {<-i>} {<HEAD> <Id.Lit_Other '^'> <Id.Lit_Other '^'> <Id.Lit_Other '^'>} ) (command.Simple words: [{<git>} {<log>} {<--oneline>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<actual>})] do_fork: T ) (C {<test_line_count>} {<Id.Lit_Equals '='>} {<3>} {<actual>}) (C {<git>} {<diff>} {<--exit-code>} {<final-commit-> ($ Id.VSub_Number '$1')}) (C {<test>} {<1>} {<Id.Lit_Equals '='>} { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<git>} {<cat-file>} {<blob>} {<HEAD> <Id.Lit_Other '^'> <Id.Lit_Colon ':'> <file1>} ) ) ) } ) (C {<test>} {($ Id.VSub_Number '$2')} {<Id.Lit_Equals '='>} { (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.Pipeline children: [ (C {<git>} {<cat-file>} {<commit>} {<HEAD> <Id.Lit_Other '^'>}) (C {<grep>} {<first>}) (C {<wc>} {<-l>}) ] negated: F ) ) } ) ] ) ] ) ) (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.ShFunction name: test_auto_fixup_fixup body: (BraceGroup children: [ (command.AndOr ops: [ Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp ] children: [ (C {<git>} {<reset>} {<--hard>} {<base>}) (command.Simple words: [{<echo>} {<1>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<file1>})] do_fork: T ) (C {<git>} {<add>} {<-u>}) (C {<test_tick>}) (C {<git>} {<commit>} {<-m>} {(DQ ($ Id.VSub_Number '$1') <'! first'>)}) (command.Simple words: [{<echo>} {<2>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<file1>})] do_fork: T ) (C {<git>} {<add>} {<-u>}) (C {<test_tick>}) (C {<git>} {<commit>} {<-m>} {(DQ ($ Id.VSub_Number '$1') <'! '> ($ Id.VSub_Number '$2') <'! first'>)} ) (C {<git>} {<tag>} {(DQ <final-> ($ Id.VSub_Number '$1') <-> ($ Id.VSub_Number '$2'))}) (C {<test_tick>}) (command.Subshell child: (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp] children: [ (C {<set_cat_todo_editor>}) (command.Simple words: [ {<test_must_fail>} {<git>} {<rebase>} {<--autosquash>} {<-i>} {<HEAD> <Id.Lit_Other '^'> <Id.Lit_Other '^'> <Id.Lit_Other '^'> <Id.Lit_Other '^'> } ] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<actual>} ) ] do_fork: T ) (command.Simple words: [{<cat>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<expected>} ) (redir op: <Id.Redir_DLessDash '<<-'> loc: (redir_loc.Fd fd:0) arg: (redir_param.MultiLine here_begin: {<EOF>} here_end_span_id: 1002 stdin_parts: [ <'pick '> (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<git>} {<rev-parse>} {<--short>} {<HEAD> <Id.Lit_Other '^'> <Id.Lit_Other '^'> <Id.Lit_Other '^'> } ) ) <' first commit\n'> ($ Id.VSub_Number '$1') <' '> (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<git>} {<rev-parse>} {<--short>} {<HEAD> <Id.Lit_Other '^'>}) ) <' '> ($ Id.VSub_Number '$1') <'! first\n'> ($ Id.VSub_Number '$1') <' '> (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<git>} {<rev-parse>} {<--short>} {<HEAD>}) ) <' '> ($ Id.VSub_Number '$1') <'! '> ($ Id.VSub_Number '$2') <'! first\n'> <'pick '> (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<git>} {<rev-parse>} {<--short>} {<HEAD> <Id.Lit_Other '^'> <Id.Lit_Other '^'>} ) ) <' second commit\n'> ] ) ) ] do_fork: T ) (C {<test_cmp>} {<expected>} {<actual>}) ] ) ) (C {<git>} {<rebase>} {<--autosquash>} {<-i>} {<HEAD> <Id.Lit_Other '^'> <Id.Lit_Other '^'> <Id.Lit_Other '^'> <Id.Lit_Other '^'>} ) (command.Simple words: [{<git>} {<log>} {<--oneline>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<actual>})] do_fork: T ) (C {<test_line_count>} {<Id.Lit_Equals '='>} {<3>} {<actual>}) ] ) (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp] children: [ (C {<git>} {<diff>} {<--exit-code>} {(DQ <final-> ($ Id.VSub_Number '$1') <-> ($ Id.VSub_Number '$2'))} ) (C {<test>} {<2>} {<Id.Lit_Equals '='>} { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<git>} {<cat-file>} {<blob>} {<HEAD> <Id.Lit_Other '^'> <Id.Lit_Colon ':'> <file1>} ) ) ) } ) (command.If arms: [ (if_arm cond: [ (C {<test>} {(DQ ($ Id.VSub_Number '$1'))} {<Id.Lit_Equals '='>} {(DQ <fixup>)}) ] action: [ (C {<test>} {<1>} {<Id.Lit_Equals '='>} { (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.Pipeline children: [ (C {<git>} {<cat-file>} {<commit>} {<HEAD> <Id.Lit_Other '^'>}) (C {<grep>} {<first>}) (C {<wc>} {<-l>}) ] negated: F ) ) } ) ] spids: [1094 1109] ) (if_arm cond: [ (C {<test>} {(DQ ($ Id.VSub_Number '$1'))} {<Id.Lit_Equals '='>} {(DQ <squash>)}) ] action: [ (C {<test>} {<3>} {<Id.Lit_Equals '='>} { (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.Pipeline children: [ (C {<git>} {<cat-file>} {<commit>} {<HEAD> <Id.Lit_Other '^'>}) (C {<grep>} {<first>}) (C {<wc>} {<-l>}) ] negated: F ) ) } ) ] spids: [1142 1157] ) ] 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.ShFunction name: set_backup_editor body: (BraceGroup children: [ (command.Simple words: [{<write_script>} {<backup-editor.sh>}] redirects: [ (redir op: <Id.Redir_DLessDash '<<-'> loc: (redir_loc.Fd fd:0) arg: (redir_param.MultiLine here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'>) <OF>} here_end_span_id: 1295 stdin_parts: [<'cp "$1" .git/backup-"$(basename "$1")"\n'>] ) ) ] do_fork: T ) (C {<test_set_editor>} {(DQ ($ Id.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>}) ] )