(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: {(SQ <'Test the post-merge hook.'>)} spids: [13] ) ] ) (C {<.>} {<'./test-lib.sh'>}) (C {<test_expect_success>} {<setup>} { (SQ <'\n'> <'\techo Data for commit0. >a &&\n'> <'\tgit update-index --add a &&\n'> <'\ttree0=$(git write-tree) &&\n'> <'\tcommit0=$(echo setup | git commit-tree $tree0) &&\n'> <'\techo Changed data for commit1. >a &&\n'> <'\tgit update-index a &&\n'> <'\ttree1=$(git write-tree) &&\n'> <'\tcommit1=$(echo modify | git commit-tree $tree1 -p $commit0) &&\n'> <' git update-ref refs/heads/master $commit0 &&\n'> <'\tgit clone ./. clone1 &&\n'> <'\tGIT_DIR=clone1/.git git update-index --add a &&\n'> <'\tgit clone ./. clone2 &&\n'> <'\tGIT_DIR=clone2/.git git update-index --add a\n'> ) } ) (command.ForEach iter_name: clone iter_words: [{<1>} {<2>}] do_arg_iter: F body: (command.DoGroup children: [ (command.Simple words: [{<cat>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<clone> (${ Id.VSub_Name clone) <'/.git/hooks/post-merge'>} ) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {(SQ <EOF>)} here_end_span_id: 75 stdin_parts: [<'#!/bin/sh\n'> <'echo $@ >> $GIT_DIR/post-merge.args\n'>] ) ) ] do_fork: T ) (C {<chmod>} {<u> <Id.Lit_Other '+'> <x>} {<clone> (${ Id.VSub_Name clone) <'/.git/hooks/post-merge'>} ) ] ) ) (C {<test_expect_success>} {(SQ <'post-merge does not run for up-to-date '>)} { (SQ <'\n'> <' GIT_DIR=clone1/.git git merge $commit0 &&\n'> <'\t! test -f clone1/.git/post-merge.args\n'> ) } ) (C {<test_expect_success>} {(SQ <'post-merge runs as expected '>)} { (SQ <'\n'> <' GIT_DIR=clone1/.git git merge $commit1 &&\n'> <'\ttest -e clone1/.git/post-merge.args\n'> ) } ) (C {<test_expect_success>} {(SQ <'post-merge from normal merge receives the right argument '>)} {(SQ <'\n'> <' grep 0 clone1/.git/post-merge.args\n'>)} ) (C {<test_expect_success>} {(SQ <'post-merge from squash merge runs as expected '>)} { (SQ <'\n'> <' GIT_DIR=clone2/.git git merge --squash $commit1 &&\n'> <'\ttest -e clone2/.git/post-merge.args\n'> ) } ) (C {<test_expect_success>} {(SQ <'post-merge from squash merge receives the right argument '>)} {(SQ <'\n'> <' grep 1 clone2/.git/post-merge.args\n'>)} ) (C {<test_done>}) ] )