From: Scott Chacon Date: Tue, 19 Aug 2008 21:45:29 GMT Subject: Re: [PATCH] add a 'pre-push' hook Message-ID: In-Reply-To: <20080820062636.6117@nanako3.lavabit.com> On Tue, Aug 19, 2008 at 2:26 PM, しらいしななこ wrote: > Quoting Scott Chacon : > >> On Tue, Aug 19, 2008 at 12:59 PM, Shawn O. Pearce wrote: >>> Jeff King wrote: >>>> >>>> One other argument I have seen is that, to prevent the proliferation of >>>> hooks, the rule is not to add a hook that could just as easily be done >>>> as a sequence of commands. IOW, what's wrong with >>>> >>>> run_my_automated_tests && git push >>> >>> Yup, I agree completely. >>> >>> Why not just setup an alias: >>> >>> git config alias.send '! run_my_tests && git push "$@"' >>> >>> and retrain your fingers to use "git send ..."? >> >> Sorry, but couldn't this argument be made about any of the hooks run >> after manual operations? ie: pre-commit, pre-applypatch, commit-msg, >> post-commit, post-applypatch? I mean, couldn't you do : >> >> git config alias.docommit '! do_pre_commit && git commit ...' ? >> >> I thought the point of these kind of hooks was to make stuff like this >> automatic and easy to standardize for a project, so people working on >> a dozen git repos don't have to remember all the aliases they set up >> in each one. > > This topic seems to come up every once in a while. > > http://thread.gmane.org/gmane.comp.version-control.git/70781/focus=71069 > http://thread.gmane.org/gmane.comp.version-control.git/79306/focus=79321 > > Somebody needs to describe the general rules in SubmittingPatches, perhaps? > > I do not understand why Junio said he thinks this pre-push hook is a good idea. This clearly is "you always would want to do before running a git command" case. > > -- > Nanako Shiraishi > http://ivory.ap.teacup.com/nanako3/ > I don't think I understand how this is different than 'pre-commit' (or, alternatively, how this does not fall under #1 in that list). If the script exits non-0, it stops the push, isn't that exactly what pre-commit does, but with 'push' instead of 'commit'? Scott