Diff options
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/t0507-hooks.sh | 29 |
1 file changed, 29 insertions, 0 deletions
diff --git a/tests/t0507-hooks.sh b/tests/t0507-hooks.sh index 8da021f..275a12b 100755 --- a/tests/t0507-hooks.sh +++ b/tests/t0507-hooks.sh @@ -108,6 +108,26 @@ test_expect_success 'set up a cache of repositories served without the suffix' ' grep -Fx "remove_suffix=1" suffix-hook ' +# scan-path finds a repository with a work tree by its .git and serves it at +# the work tree's path, while git runs its post-receive in the .git. +test_expect_success 'set up a cache of a scanned repository with a work tree' ' + git clone -q pusher scan/c && + mkdir worktree-slots && + sed "s|^cache-root=.*|cache-root=$PWD/worktree-slots|" cachedrc >worktreerc && + for page in / /a.git/ /c/ /c/log/ + do + CGIT_CONFIG="$PWD/worktreerc" PATH_INFO="$page" QUERY_STRING= cgit >/dev/null || + return 1 + done && + cp -R worktree-slots worktree-pristine && + cached_requests worktree-pristine >keys && + test_grep "|/c/0|" keys && + test_grep "|/c/log/0|" keys && + test_grep "|/a.git/0|" keys && + sed "s|^cache_root=.*|cache_root='\''$PWD/worktree-slots'\''|" cache-hook >worktree-hook && + grep -Fx "cache_root='\''$PWD/worktree-slots'\''" worktree-hook +' + # The hooks are POSIX sh, so every case runs under each such shell that is # here. Whatever a hook prints reaches the pusher, so each has to stay # silent. @@ -143,6 +163,15 @@ do test_grep ! "|1|/0|" left ' + test_expect_success "a push to a repository with a work tree drops its pages under $shell" ' + rm -rf worktree-slots && cp -R worktree-pristine worktree-slots && + (cd scan/c/.git && $shell ../../../worktree-hook 2>../../../err) && + test_must_be_empty err && + cached_requests worktree-slots >left && + test_grep "|/a.git/0|" left && + test_grep ! "|/c/" left + ' + test_expect_success "a repository named in cgitrc gives the hook its url under $shell" ' fresh_slots && git -C scan/b.git config hooks.cgiturl b.git && |
