{"thread":{"id":"37858","subject":"[ANNOUNCE] A pre-receive hook to intelligently block binary data","startedAt":"2014-10-31T19:25:41Z","lastAt":"2014-10-31T19:25:41Z","messageCount":1,"participants":["Ævar Arnfjörð Bjarmason"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"251269","messageId":"CACBZZX64ofaQSoOMhQcjx+ED2LOpdDVZJ_5TSjotuBv4m+Fb5A@mail.gmail.com","threadId":"37858","inReplyTo":null,"subject":"[ANNOUNCE] A pre-receive hook to intelligently block binary data","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2014-10-31T19:25:41Z","receivedAt":"2014-10-31T19:25:41Z","isPatch":false,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"After searching around a bit I couldn't find a stand-alone Git hook\nthat would intelligently block binary data pushes so I wrote my own:\nhttps://github.com/avar/pre-receive-reject-binaries\n\nMain features:\n\n * Quota per-commit for how much binary data is OK\n * Ability to optionally allow users to override binary pushes by\nincluding a notice in their commit messages\n * Doesn't disallow removing existing binary data, or renaming\nexisting binary files\n * Will block commits that include references to existing binary blobs though\n * Spots cases where a push is pushing commits that add and then\nremove binary blobs (i.e. counts net additions)\n * Has hookable support for logging by piping its output to external\ncommands when it runs or when it rejects/unblocks a binary push. I'm\nusing this for logging its output to a logfile, and to send E-Mails\nwhen it blocks/is unblocked.\n* Only requires a stock perl install, should run on any *nix-like OS\nout of the box\n* Should be relatively fast compared to some other similar solutions\nI've seen, i.e. it parses the output of one \"git-log --stat\" command\nfor the entire push, and doesn't e.g. do a \"git show\" for each commit\nbeing pushed.\n\nOne general note about git-log output: I was disappointed to see that\nthere was no easily parsable \"git log\" output that showed you how much\nbinary files increased in size, --numstat will just show \"-\" for\nbinary files, and it's non-trivial to parse the \"--stat\" output. It's\nmeant for human consumption and will sometimes include variations in\nhow much whitespace is inserted.\n"}]}