(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'test_description='> name:test_description) op: assign_op.Equal rhs: {(SQ <'Test the post-rewrite hook.'>)} spids: [13] ) ] redirects: [] ) (C {<.>} {<'./test-lib.sh'>}) (C {<test_expect_success>} {(SQ <setup>)} { (SQ <'\n'> <'\ttest_commit A foo A &&\n'> <'\ttest_commit B foo B &&\n'> <'\ttest_commit C foo C &&\n'> <'\ttest_commit D foo D &&\n'> <'\tgit checkout A^0 &&\n'> <'\ttest_commit E bar E &&\n'> <'\ttest_commit F foo F &&\n'> <'\tgit checkout master\n'> ) } ) (C {<mkdir>} {<'.git/hooks'>}) (command.Simple words: [{<cat>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<'.git/hooks/post-rewrite'>} ) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<EOF>} here_end_span_id: 69 stdin_parts: [ <'#!/bin/sh\n'> <'echo '> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\$'> ch:'$') <'@ > '> <Id.Right_DoubleQuote '"'> ($ Id.VSub_DollarName TRASH_DIRECTORY) <Id.Right_DoubleQuote '"'> <'/post-rewrite.args\n'> <'cat > '> <Id.Right_DoubleQuote '"'> ($ Id.VSub_DollarName TRASH_DIRECTORY) <Id.Right_DoubleQuote '"'> <'/post-rewrite.data\n'> ] ) ) ] more_env: [] do_fork: T ) (C {<chmod>} {<u> <Id.Lit_Other '+'> <x>} {<'.git/hooks/post-rewrite'>}) (command.ShFunction name: clear_hook_input body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [(C {<rm>} {<-f>} {<post-rewrite.args>} {<post-rewrite.data>})] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name: verify_hook_input body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<test_cmp>} {<expected.args>} {(DQ ($ Id.VSub_DollarName TRASH_DIRECTORY)) <'/post-rewrite.args'>} ) (C {<test_cmp>} {<expected.data>} {(DQ ($ Id.VSub_DollarName TRASH_DIRECTORY)) <'/post-rewrite.data'>} ) ] ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (C {<test_expect_success>} {(SQ <'git commit --amend'>)} { (SQ <'\n'> <'\tclear_hook_input &&\n'> <'\techo "D new message" > newmsg &&\n'> <'\toldsha=$(git rev-parse HEAD^0) &&\n'> <'\tgit commit -Fnewmsg --amend &&\n'> <'\techo amend > expected.args &&\n'> <'\techo $oldsha $(git rev-parse HEAD^0) > expected.data &&\n'> <'\tverify_hook_input\n'> ) } ) (C {<test_expect_success>} {(SQ <'git commit --amend --no-post-rewrite'>)} { (SQ <'\n'> <'\tclear_hook_input &&\n'> <'\techo "D new message again" > newmsg &&\n'> <'\tgit commit --no-post-rewrite -Fnewmsg --amend &&\n'> <'\ttest ! -f post-rewrite.args &&\n'> <'\ttest ! -f post-rewrite.data\n'> ) } ) (C {<test_expect_success>} {(SQ <'git rebase'>)} { (SQ <'\n'> <'\tgit reset --hard D &&\n'> <'\tclear_hook_input &&\n'> <'\ttest_must_fail git rebase --onto A B &&\n'> <'\techo C > foo &&\n'> <'\tgit add foo &&\n'> <'\tgit rebase --continue &&\n'> <'\techo rebase >expected.args &&\n'> <'\tcat >expected.data <<-EOF &&\n'> <'\t$(git rev-parse C) $(git rev-parse HEAD^)\n'> <'\t$(git rev-parse D) $(git rev-parse HEAD)\n'> <'\tEOF\n'> <'\tverify_hook_input\n'> ) } ) (C {<test_expect_success>} {(SQ <'git rebase --skip'>)} { (SQ <'\n'> <'\tgit reset --hard D &&\n'> <'\tclear_hook_input &&\n'> <'\ttest_must_fail git rebase --onto A B &&\n'> <'\ttest_must_fail git rebase --skip &&\n'> <'\techo D > foo &&\n'> <'\tgit add foo &&\n'> <'\tgit rebase --continue &&\n'> <'\techo rebase >expected.args &&\n'> <'\tcat >expected.data <<-EOF &&\n'> <'\t$(git rev-parse D) $(git rev-parse HEAD)\n'> <'\tEOF\n'> <'\tverify_hook_input\n'> ) } ) (C {<test_expect_success>} {(SQ <'git rebase --skip the last one'>)} { (SQ <'\n'> <'\tgit reset --hard F &&\n'> <'\tclear_hook_input &&\n'> <'\ttest_must_fail git rebase --onto D A &&\n'> <'\tgit rebase --skip &&\n'> <'\techo rebase >expected.args &&\n'> <'\tcat >expected.data <<-EOF &&\n'> <'\t$(git rev-parse E) $(git rev-parse HEAD)\n'> <'\tEOF\n'> <'\tverify_hook_input\n'> ) } ) (C {<test_expect_success>} {(SQ <'git rebase -m'>)} { (SQ <'\n'> <'\tgit reset --hard D &&\n'> <'\tclear_hook_input &&\n'> <'\ttest_must_fail git rebase -m --onto A B &&\n'> <'\techo C > foo &&\n'> <'\tgit add foo &&\n'> <'\tgit rebase --continue &&\n'> <'\techo rebase >expected.args &&\n'> <'\tcat >expected.data <<-EOF &&\n'> <'\t$(git rev-parse C) $(git rev-parse HEAD^)\n'> <'\t$(git rev-parse D) $(git rev-parse HEAD)\n'> <'\tEOF\n'> <'\tverify_hook_input\n'> ) } ) (C {<test_expect_success>} {(SQ <'git rebase -m --skip'>)} { (SQ <'\n'> <'\tgit reset --hard D &&\n'> <'\tclear_hook_input &&\n'> <'\ttest_must_fail git rebase --onto A B &&\n'> <'\ttest_must_fail git rebase --skip &&\n'> <'\techo D > foo &&\n'> <'\tgit add foo &&\n'> <'\tgit rebase --continue &&\n'> <'\techo rebase >expected.args &&\n'> <'\tcat >expected.data <<-EOF &&\n'> <'\t$(git rev-parse D) $(git rev-parse HEAD)\n'> <'\tEOF\n'> <'\tverify_hook_input\n'> ) } ) (C {<.>} {(DQ ($ Id.VSub_DollarName TEST_DIRECTORY)) <'/lib-rebase.sh'>}) (C {<set_fake_editor>}) (command.ShFunction name: test_fail_interactive_rebase body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Subshell child: (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp] children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'FAKE_LINES='> name:FAKE_LINES) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Number 1))} spids: [304] ) ] redirects: [] ) (C {<shift>}) (C {<export>} {<FAKE_LINES>}) (C {<test_must_fail>} {<git>} {<rebase>} {<-i>} {(DQ ($ Id.VSub_At '@'))}) ] ) redirects: [] ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (C {<test_expect_success>} {(SQ <'git rebase -i (unchanged)'>)} { (SQ <'\n'> <'\tgit reset --hard D &&\n'> <'\tclear_hook_input &&\n'> <'\ttest_fail_interactive_rebase "1 2" --onto A B &&\n'> <'\techo C > foo &&\n'> <'\tgit add foo &&\n'> <'\tgit rebase --continue &&\n'> <'\techo rebase >expected.args &&\n'> <'\tcat >expected.data <<-EOF &&\n'> <'\t$(git rev-parse C) $(git rev-parse HEAD^)\n'> <'\t$(git rev-parse D) $(git rev-parse HEAD)\n'> <'\tEOF\n'> <'\tverify_hook_input\n'> ) } ) (C {<test_expect_success>} {(SQ <'git rebase -i (skip)'>)} { (SQ <'\n'> <'\tgit reset --hard D &&\n'> <'\tclear_hook_input &&\n'> <'\ttest_fail_interactive_rebase "2" --onto A B &&\n'> <'\techo D > foo &&\n'> <'\tgit add foo &&\n'> <'\tgit rebase --continue &&\n'> <'\techo rebase >expected.args &&\n'> <'\tcat >expected.data <<-EOF &&\n'> <'\t$(git rev-parse D) $(git rev-parse HEAD)\n'> <'\tEOF\n'> <'\tverify_hook_input\n'> ) } ) (C {<test_expect_success>} {(SQ <'git rebase -i (squash)'>)} { (SQ <'\n'> <'\tgit reset --hard D &&\n'> <'\tclear_hook_input &&\n'> <'\ttest_fail_interactive_rebase "1 squash 2" --onto A B &&\n'> <'\techo C > foo &&\n'> <'\tgit add foo &&\n'> <'\tgit rebase --continue &&\n'> <'\techo rebase >expected.args &&\n'> <'\tcat >expected.data <<-EOF &&\n'> <'\t$(git rev-parse C) $(git rev-parse HEAD)\n'> <'\t$(git rev-parse D) $(git rev-parse HEAD)\n'> <'\tEOF\n'> <'\tverify_hook_input\n'> ) } ) (C {<test_expect_success>} {(SQ <'git rebase -i (fixup without conflict)'>)} { (SQ <'\n'> <'\tgit reset --hard D &&\n'> <'\tclear_hook_input &&\n'> <'\tFAKE_LINES="1 fixup 2" git rebase -i B &&\n'> <'\techo rebase >expected.args &&\n'> <'\tcat >expected.data <<-EOF &&\n'> <'\t$(git rev-parse C) $(git rev-parse HEAD)\n'> <'\t$(git rev-parse D) $(git rev-parse HEAD)\n'> <'\tEOF\n'> <'\tverify_hook_input\n'> ) } ) (C {<test_expect_success>} {(SQ <'git rebase -i (double edit)'>)} { (SQ <'\n'> <'\tgit reset --hard D &&\n'> <'\tclear_hook_input &&\n'> <'\tFAKE_LINES="edit 1 edit 2" git rebase -i B &&\n'> <'\tgit rebase --continue &&\n'> <'\techo something > foo &&\n'> <'\tgit add foo &&\n'> <'\tgit rebase --continue &&\n'> <'\techo rebase >expected.args &&\n'> <'\tcat >expected.data <<-EOF &&\n'> <'\t$(git rev-parse C) $(git rev-parse HEAD^)\n'> <'\t$(git rev-parse D) $(git rev-parse HEAD)\n'> <'\tEOF\n'> <'\tverify_hook_input\n'> ) } ) (C {<test_expect_success>} {(SQ <'git rebase -i (exec)'>)} { (SQ <'\n'> <'\tgit reset --hard D &&\n'> <'\tclear_hook_input &&\n'> <'\tFAKE_LINES="edit 1 exec_false 2" git rebase -i B &&\n'> <'\techo something >bar &&\n'> <'\tgit add bar &&\n'> <'\t# Fails because of exec false\n'> <'\ttest_must_fail git rebase --continue &&\n'> <'\tgit rebase --continue &&\n'> <'\techo rebase >expected.args &&\n'> <'\tcat >expected.data <<-EOF &&\n'> <'\t$(git rev-parse C) $(git rev-parse HEAD^)\n'> <'\t$(git rev-parse D) $(git rev-parse HEAD)\n'> <'\tEOF\n'> <'\tverify_hook_input\n'> ) } ) (C {<test_done>}) ] )