Diff options
| -rwxr-xr-x | custom/hooks/post-receive.cgit-age | 7 | |
| -rwxr-xr-x | tests/t0507-hooks.sh | 9 |
2 files changed, 13 insertions, 3 deletions
diff --git a/custom/hooks/post-receive.cgit-age b/custom/hooks/post-receive.cgit-age index 82a13f0..5fdffa9 100755 --- a/custom/hooks/post-receive.cgit-age +++ b/custom/hooks/post-receive.cgit-age @@ -2,9 +2,10 @@ # Updates the age-file cgit reads for the idle column. The path below is the # default age-file, so a cgitrc that changes the setting needs the same change -# here. A file the pusher cannot write stays as it was, and nothing here -# complains or exits non-zero, so the pusher is not shown an error over a stale -# idle column. +# here. A file in a directory the pusher cannot write stays as it was, and +# nothing here complains or exits non-zero, so the pusher is not shown an error +# over a stale idle column. Replacing the file takes only its directory, so one +# the pusher cannot write itself is still brought up to date. # # To install the hook, copy or link it to hooks/post-receive in each # repository. Git runs one post-receive per repository, so fold this together diff --git a/tests/t0507-hooks.sh b/tests/t0507-hooks.sh index c95c8a3..d387025 100755 --- a/tests/t0507-hooks.sh +++ b/tests/t0507-hooks.sh @@ -187,6 +187,15 @@ do test_cmp expect-entries entries ' + test_expect_success "the age hook replaces a file it cannot write in a directory it can under $shell" ' + rm -f plain.git/info/web/last-modified && + cp kept plain.git/info/web/last-modified && + chmod 444 plain.git/info/web/last-modified && + (cd plain.git && $shell "$HOOK_DIRECTORY/post-receive.cgit-age" 2>../err) && + test_must_be_empty err && + test_cmp expect plain.git/info/web/last-modified + ' + test_expect_success "the age hook leaves a repository with no branches as it was under $shell" ' git init -q --bare tags-$shell.git && git -C work push -q ../tags-$shell.git release && |
