develooper Front page | perl.perl5.porters | Postings from January 2016

git client hook to enforce a smoke test before commit

Thread Next
Jarkko Hietaniemi
January 29, 2016 22:17
git client hook to enforce a smoke test before commit
Message ID:
I've been using this lately, saved me some oopsies, wrote them after 
some embarrassing and rage-inducing incidents.  I'm not that well versed 
in git, very probably enhancements and fixes can be made.

So what this does: before git push, a test build is launched, and only 
if that passes, and one hits 'y' in the keyboard, it gets truly pushed. 
There's special code for handling the "Greer smokes".

(1) The .git/hooks/pre-push is a symlink to the attached

(2) That *.sh calls the attached perl-git-build which I have in my $PATH

(3) The perl-git-build opens $HOME/.perl-git-build.rc, sample below

In my setup my laptop is a little old and tired, but I have a relatively 
beefy and underutilized desktop.  The perl-git-guild ssh:s into it, 
prepares the source tree appropriately (see below) and does the build. 
That is the remote_host in the .rc file, like this:


The perl-git-build can be used also explicitly to do quickie test 
builds.  There are three 'modes': plain, patch, and snapshot.  The 
'plain' mode just does a git clone of blead HEAD (I guess the name 
'plain' is not the best possible).  The 'patch' does git format-patch 
$origin_sha.. of the local head and in the build host applies those 
patches.  The 'snapshot' does git archive of of the local head and 
unpacks that in the remote host.

Enjoy responsibly.

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About