do we need the 'exec' keyword in there? i removed it in the pre-commit hook.
On Tue, Oct 20, 2015 at 1:06 PM, <[email protected]> wrote: > Repository: mesos > Updated Branches: > refs/heads/master 70fd9ce62 -> 5e68b23e7 > > > Added post-rewrite hook. > > Review: https://reviews.apache.org/r/38978 > > > Project: http://git-wip-us.apache.org/repos/asf/mesos/repo > Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/5e68b23e > Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/5e68b23e > Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/5e68b23e > > Branch: refs/heads/master > Commit: 5e68b23e7c05d1ab4cd99acc5f30df965678c9bd > Parents: 70fd9ce > Author: haosdent huang <[email protected]> > Authored: Tue Oct 20 16:03:05 2015 -0400 > Committer: Joris Van Remoortere <[email protected]> > Committed: Tue Oct 20 16:05:35 2015 -0400 > > ---------------------------------------------------------------------- > bootstrap | 6 +++++- > support/hooks/post-rewrite | 30 ++++++++++++++++++++++++++++++ > 2 files changed, 35 insertions(+), 1 deletion(-) > ---------------------------------------------------------------------- > > > http://git-wip-us.apache.org/repos/asf/mesos/blob/5e68b23e/bootstrap > ---------------------------------------------------------------------- > diff --git a/bootstrap b/bootstrap > index 779b33c..89d986f 100755 > --- a/bootstrap > +++ b/bootstrap > @@ -10,11 +10,15 @@ __EOF__ > exit 1 > fi > > -# Install mesos default commit hook and gitignore template. > +# Install mesos default hooks and gitignore template. > if test ! -e .git/hooks/pre-commit; then > ln -s ../../support/hooks/pre-commit .git/hooks/pre-commit > fi > > +if test ! -e .git/hooks/post-rewrite; then > + ln -s ../../support/hooks/post-rewrite .git/hooks/post-rewrite > +fi > + > if test ! -e .gitignore; then > ln -s .gitignore-template .gitignore > fi > > > http://git-wip-us.apache.org/repos/asf/mesos/blob/5e68b23e/support/hooks/post-rewrite > ---------------------------------------------------------------------- > diff --git a/support/hooks/post-rewrite b/support/hooks/post-rewrite > new file mode 100755 > index 0000000..1d6df6f > --- /dev/null > +++ b/support/hooks/post-rewrite > @@ -0,0 +1,30 @@ > +#!/bin/sh > +# > +# A hook script to verify what is about to be committed. > +# Called by "git commit --amend" or "git rebase". The hook exits with > +# non-zero status and warning messages if the files being rewritten do > +# not conform to to the Mesos style. > +# > +# To enable this hook, do this from the root of the repo: > +# > +# $ ln -s ../../support/hooks/post_rewrite .git/hooks/post_rewrite > + > +# Redirect output to stderr. > +exec 1>&2 > + > +# If there are whitespace errors, print the offending file names. > +## In git, '@~' represent previous commit. We check the whitespace between > +## current head and previous commit after a commit is rewritten. > +git diff-index --check @~ -- || exit 1 > + > +# Check Mesos style. > +## In git, '@' represent current head, '@~' represent previous commit. We > check > +## the style of changes between current head and previous commit after a > commit > +## is rewritten. > +exec git diff --name-only --diff-filter=AM @~..@ | xargs > ./support/mesos-style.py || exit 1 > + > +# Check that the commits are properly split between mesos, libprocess and > stout. > +## In git, '@' represent current head, '@~' represent previous commit. We > check > +## the style of changes between current head and previous commit after a > commit > +## is rewritten. > +exec git diff --name-only --diff-filter=AMD @~..@ | xargs > ./support/mesos_split.py || exit 1 > >
