Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/t5544-pack-objects-hook.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / t5544-pack-objects-hook.sh` 78 lines ยท 2289 bytes Raw Blame History 1 #!/bin/sh 2 3 test_description='test custom script in place of pack-objects' 4 5 . ./test-lib.sh 6 7 test_expect_success 'create some history to fetch' ' 8 test_commit one && 9 test_commit two 10 ' 11 12 test_expect_success 'create debugging hook script' ' 13 write_script .git/hook <<-\EOF 14 echo >&2 "hook running" 15 echo "$*" >hook.args 16 cat >hook.stdin 17 "$@" hook.stdout 18 cat hook.stdout 19 EOF 20 ' 21 22 clear_hook_results () { 23 rm -rf .git/hook.* dst.git 24 } 25 26 test_expect_success 'hook runs via global config' ' 27 clear_hook_results && 28 test_config_global uploadpack.packObjectsHook ./hook && 29 git clone --no-local . dst.git 2>stderr && 30 test_grep "hook running" stderr 31 ' 32 33 test_expect_success 'hook outputs are sane' ' 34 # check that we recorded a usable pack 35 git index-pack --stdin <.git/hook.stdout && 36 37 # check that we recorded args and stdin. We do not check 38 # the full argument list or the exact pack contents, as it would make 39 # the test brittle. So just sanity check that we could replay 40 # the packing procedure. 41 test_grep "^git" .git/hook.args && 42 $(cat .git/hook.args) <.git/hook.stdin >replay 43 ' 44 45 test_expect_success 'hook runs from -c config' ' 46 clear_hook_results && 47 git clone --no-local \ 48 -u "git -c uploadpack.packObjectsHook=./hook upload-pack" \ 49 . dst.git 2>stderr && 50 test_grep "hook running" stderr 51 ' 52 53 test_expect_success 'hook does not run from repo config' ' 54 clear_hook_results && 55 test_config uploadpack.packObjectsHook "./hook" && 56 git clone --no-local . dst.git 2>stderr && 57 test_grep ! "hook running" stderr && 58 test_path_is_missing .git/hook.args && 59 test_path_is_missing .git/hook.stdin && 60 test_path_is_missing .git/hook.stdout && 61 62 # check that global config is used instead 63 test_config_global uploadpack.packObjectsHook ./hook && 64 git clone --no-local . dst2.git 2>stderr && 65 test_grep "hook running" stderr 66 ' 67 68 test_expect_success 'hook works with partial clone' ' 69 clear_hook_results && 70 test_config_global uploadpack.packObjectsHook ./hook && 71 test_config_global uploadpack.allowFilter true && 72 git clone --bare --no-local --filter=blob:none . dst.git && 73 git -C dst.git rev-list --objects --missing=allow-any --no-object-names --all >objects && 74 git -C dst.git cat-file --batch-check="%(objecttype)" types && 75 test_grep ! blob types 76 ' 77 78 test_done