(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"Test the post-merge hook.">)} spids: [13] ) ] 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"> ) } ) (ForEach iter_name: clone iter_words: [{(1)} {(2)}] do_arg_iter: False body: (DoGroup children: [ (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(clone) (${ VSub_Name clone) (/.git/hooks/post-merge)} spids: [61] ) (HereDoc op_id: Redir_DLess fd: -1 body: {("#!/bin/sh\n") ("echo $@ >> $GIT_DIR/post-merge.args\n")} do_expansion: False here_end: EOF was_filled: True spids: [68] ) ] ) (C {(chmod)} {(u) (Lit_Other "+") (x)} {(clone) (${ VSub_Name clone) (/.git/hooks/post-merge)} ) ] spids: [56 86] ) spids: [50 54] ) (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)}) ] )