(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"test custom script in place of pack-objects">)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (C {(test_expect_success)} {(SQ <"create some history to fetch">)} {(SQ <"\n"> <"\ttest_commit one &&\n"> <"\ttest_commit two\n">)} ) (C {(test_expect_success)} {(SQ <"create debugging hook script">)} { (SQ <"\n"> <"\twrite_script .git/hook <<-\\EOF\n"> <"\t\techo >&2 \"hook running\"\n"> <"\t\techo \"$*\" >hook.args\n"> <"\t\tcat >hook.stdin\n"> <"\t\t\"$@\" <hook.stdin >hook.stdout\n"> <"\t\tcat hook.stdout\n"> <"\tEOF\n"> ) } ) (FuncDef name: clear_hook_results body: (BraceGroup children: [(C {(rm)} {(-rf)} {(.git/hook.) (Lit_Other "*")} {(dst.git)})] spids: [50] ) spids: [45 49] ) (C {(test_expect_success)} {(SQ <"hook runs via global config">)} { (SQ <"\n"> <"\tclear_hook_results &&\n"> <"\ttest_config_global uploadpack.packObjectsHook ./hook &&\n"> <"\tgit clone --no-local . dst.git 2>stderr &&\n"> <"\tgrep \"hook running\" stderr\n"> ) } ) (C {(test_expect_success)} {(SQ <"hook outputs are sane">)} { (SQ <"\n"> <"\t# check that we recorded a usable pack\n"> <"\tgit index-pack --stdin <.git/hook.stdout &&\n"> <"\n"> <"\t# check that we recorded args and stdin. We do not check\n"> <"\t# the full argument list or the exact pack contents, as it would make\n"> <"\t# the test brittle. So just sanity check that we could replay\n"> <"\t# the packing procedure.\n"> <"\tgrep \"^git\" .git/hook.args &&\n"> <"\t$(cat .git/hook.args) <.git/hook.stdin >replay\n"> ) } ) (C {(test_expect_success)} {(SQ <"hook runs from -c config">)} { (SQ <"\n"> <"\tclear_hook_results &&\n"> <"\tgit clone --no-local \\\n"> <"\t -u \"git -c uploadpack.packObjectsHook=./hook upload-pack\" \\\n"> <"\t . dst.git 2>stderr &&\n"> <"\tgrep \"hook running\" stderr\n"> ) } ) (C {(test_expect_success)} {(SQ <"hook does not run from repo config">)} { (SQ <"\n"> <"\tclear_hook_results &&\n"> <"\ttest_config uploadpack.packObjectsHook \"./hook\" &&\n"> <"\tgit clone --no-local . dst.git 2>stderr &&\n"> <"\t! grep \"hook running\" stderr &&\n"> <"\ttest_path_is_missing .git/hook.args &&\n"> <"\ttest_path_is_missing .git/hook.stdin &&\n"> <"\ttest_path_is_missing .git/hook.stdout\n"> ) } ) (C {(test_done)}) ] )