diff options
| author | dev <dev@example> | 2026-11-13 20:34:47 +0000 |
|---|---|---|
| committer | dev <dev@example> | 2026-11-13 20:34:47 +0000 |
| commit | 23b41dd208ca16712470a18c1f42d4f22f364f9e (patch) | |
| tree | 2d0cb8c7cf416e8d2ffb10fd7a88cd71ad69121c /src/edit.c | |
| parent | 19a3eb704479fa01c383960ca21a057e8c5fbaf7 (diff) | |
| download | access-control-23b41dd208ca16712470a18c1f42d4f22f364f9e.tar.gz access-control-23b41dd208ca16712470a18c1f42d4f22f364f9e.zip | |
tests: drive the binary the way a hook is driven
148 checks against the real binary, with no git anywhere in the suite.
The unit tests pin the semantics and were passing throughout. They cannot say
that an option telling the program not to run git still runs it, that a
repository is detected against a path built without the working directory in
it, that "--out" is being granted as a branch name, or that a policy with no
parse errors but no file behind it is announced as being in force. Those are
four of the bugs this suite found.
So it feeds the binary what a receive hook gets: an identity in the
environment, "old new ref" lines on stdin, the repository as the working
directory, the program reached through a symlink named pre-receive with git's
own argument in hand - an argument that is git's, and must not be read as one
of ours. The two facts only the object store knows are supplied rather than
derived (--ff, --head), which is what makes it deterministic and what makes it
a test of the consequences of each answer: an update that cannot be shown to be
a fast-forward costs force, a deletion whose HEAD cannot be read costs admin.
It covers the ladder and the ref grammar, the protected raise, @all, identity
over both transports and the absence of one, a push of several refs stopping at
the first refusal, input that is not a push, every way the policy can be
unusable, validate against a tree that stands in for a host, the editing
commands against real files (comments preserved, mode preserved, no temporary
left behind, a file that does not parse refused without being touched), and
make install into a DESTDIR - including that the link is relative and that an
existing policy survives.
Runs under dash and busybox ash as well as bash, because the container this
eventually serves is Alpine.
Diffstat (limited to 'src/edit.c')
0 files changed, 0 insertions, 0 deletions
