AgeCommit message (Collapse)AuthorLines
Say which earlier tests each hook case needsBryce Kwon-2/+6
Push to each hook installed as post-receiveBryce Kwon-0/+35
No hook ran the way git runs it, so the shebang, the executable bit, GIT_DIR, the refs on stdin and the remote: lines a pusher sees were all untested.
Check the commit-graph hook with a git too oldBryce Kwon-0/+24
The header says a git too old for the options leaves the graph as it was and the hook stays silent, but every run had a git that could write it.
Run the hooks under every POSIX shell presentBryce Kwon-24/+45
Only sh, dash, ksh and bash were tried, so busybox sh ran only where it is /bin/sh, and mksh, yash, posh and zsh's sh mode never ran. Where sh is a link to dash, the same shell ran twice. A shell reached by two names now runs once, and the list is said so a run shows what it covered.
Drop cached pages asked for with an escaped urlBryce Kwon-2/+20
README tells a visitor to write a plus in the query form as %2b, and cgit caches such a page under the raw query, but the hook compared that query with the url as it stands. A push to foo+bar.git left its pages under url=foo%2bbar.git/ and r=foo%2Bbar.git cached and stale until their ttl ran out. Decoding in sh would take more than the hook is worth, so a query with a % or a + now counts as stale, which costs another repository's page at most a refill.
Check more of the keys the cache hook readsBryce Kwon-0/+16
No page asked for with r= was cached, no slot held a head that does not parse as cgit's, and the hook never met a cache root that was missing, so ignoring r=, keeping an unreadable slot, or complaining without a cache all passed.
Check that a later push adds a graph layerBryce Kwon-2/+8
The check was a negated test_cmp, which also passes when either file is missing, and a changed chain does not prove the new layer was written. The chain's last line now has to name a graph file that exists and was not in the chain before the push.
Check the cache hook in a non-bare repositoryBryce Kwon-0/+29
scan-path finds such a repository by its .git and serves it at the work tree's path, so the hook has to strip the /.git it runs in. Only bare repositories were tried, and a hook that kept it passed.
Check the cache hook with remove_suffix setBryce Kwon-0/+37
Nothing ran the hook against a cache filled with remove-suffix=1, so a hook that kept the .git on the url, and so dropped none of the pages cgit had cached under the shorter one, passed.
Check that cgit reads what the age hook writesBryce Kwon-0/+6
The hook exists to feed the idle column, but nothing had cgit read an age file, so a hook writing a date cgit cannot parse, or one at a path cgit no longer reads, passed.
Say what the age hook does with a read-only fileBryce Kwon-0/+9
The header said a file the pusher cannot write stays as it was, but the hook replaces it through mv, which needs only the directory, and with stdin not a terminal mv does so without asking. That is the useful behaviour, so the header now says so, and a test holds the hook to it. Only a directory the pusher cannot write keeps the old file, which was the one case tested.
Check what the age hook leaves behindBryce Kwon-4/+19
A repository with no branches is meant to keep the date cgit already had, and the hook writes through a temporary file that must not be left beside the real one. Neither was checked.
Check the modes the hooks write underBryce Kwon-0/+38
No hook ran under a restrictive umask, so dropping the forced umask 022 passed, and the age file and the graph would then be unreadable to the web server. Git alone writes the graph as -r-------- under umask 077. core.sharedRepository was only tried as group, so the case folding and the numeric modes went unchecked.
Run every hook case under every shellBryce Kwon-84/+87
The cache hook's named url, no url and no access cases, the age hook's missing directory and shared group, and the first commit-graph write ran under sh alone, though the comment said every shell. The runs that did loop over the shells ignored what the hook printed, which reaches the pusher, so a hook that wrote to stderr or broke on a bashism under dash alone could pass.
Check the cache the hook tests start fromBryce Kwon-17/+51
The checks that pages went had nothing proving they were there to begin with, so they would pass with nothing removed if the scan list stopped being written or two keys shared a slot. Nor did anything check that the copy of the hook was pointed at the trash directory, and a renamed line would have left it wiping the system's cache wherever the test user can write it. cached_requests read the lock and the scan list as if they were pages and hid a failing dd. The test without access could not fail, since nothing can be removed there and the scan list alone names a.git, so it now compares the slots with the pristine copy.
Check the age hook picks the right dateBryce Kwon-7/+24
The age fixture had one branch whose author and committer dates were the same, and its only tag was lightweight on that commit. Sorting oldest first, writing the author date or reading every ref rather than the branches all passed, and the expected date came from the same for-each-ref the hook runs. The dates now disagree on every one of those points and the hook's answer is held to a literal date, under every shell.
Move the later tests to the config writersBryce Kwon-2/+2
The one-line request wrappers go with them. Configs with several repositories, a key out of place on purpose, the cache on or no repository of their own stay written out.
Keep the age hook quiet when it cannot writeBryce Kwon-0/+23
Keep the commit-graph current in an example hookBryce Kwon-1/+23
cgit's log, blame and graph pages read commits from the commit-graph when a repository has one, and its changed path filters let a walk limited to one file skip the commits that never touched it. git gc writes a graph only now and then and starts those filters only when a write asks for them, so the hook writes a split layer with them after each push.
Drop only the cache a push makes staleBryce Kwon-17/+91
The hook cleared every slot on a push to any repository. cgit writes the request a slot answers at its head, so the hook now reads it back and drops only the pushed repository's pages and the index. It finds the repository's url from scan-path or hooks.cgiturl, and with neither it clears everything as before.
Keep the age hook's directory group writableBryce Kwon-0/+20
The hook forced a 022 umask, so in a repository shared with a group the first pusher owned info/web and every other member's push failed to write the age file there.
Keep the cache hook's rm errors from pushersBryce Kwon-0/+34
Only the exit status was hidden, so a pusher without write access to the cache root saw a permission error per cached page, against what the hook's own comment promised.