diff options
Diffstat (limited to 'tests')
-rwxr-xr-xtests/t0507-hooks.sh20
1 file changed, 20 insertions, 0 deletions
diff --git a/tests/t0507-hooks.sh b/tests/t0507-hooks.sh
index ff42468..977931b 100755
--- a/tests/t0507-hooks.sh
+++ b/tests/t0507-hooks.sh
@@ -31,4 +31,24 @@ test_expect_success SANITY 'the cache hook shows a pusher no error' '
test_must_be_empty err
'
+test_expect_success 'the age hook writes the newest branch date' '
+ test_create_repo work &&
+ test_commit -C work first &&
+ git init -q --bare plain.git &&
+ git -C work push -q ../plain.git HEAD:refs/heads/main &&
+ (cd plain.git && sh "$HOOK_DIRECTORY/post-receive.cgit-age") &&
+ git -C plain.git for-each-ref --format="%(committerdate:iso8601)" refs/heads/main >expect &&
+ test_cmp expect plain.git/info/web/last-modified
+'
+
+# git keeps a shared repository group writable whatever the pusher's umask,
+# and the next member to push has to be able to replace the file.
+test_expect_success SANITY 'the age hook keeps a shared directory group writable' '
+ git init -q --bare --shared=group shared.git &&
+ git -C work push -q ../shared.git HEAD:refs/heads/main &&
+ (cd shared.git && umask 022 && sh "$HOOK_DIRECTORY/post-receive.cgit-age") &&
+ ls -ld shared.git/info/web >mode &&
+ grep "^drwxrw[xs]" mode
+'
+
test_done