[ANNOUNCE] A pre-receive hook to intelligently block binary data

Ævar Arnfjörð Bjarmason avarab at gmail.com
Fri Oct 31 19:25:41 GMT 2014


After searching around a bit I couldn't find a stand-alone Git hook
that would intelligently block binary data pushes so I wrote my own:
https://github.com/avar/pre-receive-reject-binaries

Main features:

 * Quota per-commit for how much binary data is OK
 * Ability to optionally allow users to override binary pushes by
including a notice in their commit messages
 * Doesn't disallow removing existing binary data, or renaming
existing binary files
 * Will block commits that include references to existing binary blobs though
 * Spots cases where a push is pushing commits that add and then
remove binary blobs (i.e. counts net additions)
 * Has hookable support for logging by piping its output to external
commands when it runs or when it rejects/unblocks a binary push. I'm
using this for logging its output to a logfile, and to send E-Mails
when it blocks/is unblocked.
* Only requires a stock perl install, should run on any *nix-like OS
out of the box
* Should be relatively fast compared to some other similar solutions
I've seen, i.e. it parses the output of one "git-log --stat" command
for the entire push, and doesn't e.g. do a "git show" for each commit
being pushed.

One general note about git-log output: I was disappointed to see that
there was no easily parsable "git log" output that showed you how much
binary files increased in size, --numstat will just show "-" for
binary files, and it's non-trivial to parse the "--stat" output. It's
meant for human consumption and will sometimes include variations in
how much whitespace is inserted.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


More information about the git-announce mailing list