From: Junio C Hamano <gitster@pobox.com>
To: "Scott Chacon" <schacon@gmail.com>
Cc: しらいしななこ <nanako3@lavabit.com>,
"Shawn O. Pearce" <spearce@spearce.org>,
"Jeff King" <peff@peff.net>,
git@vger.kernel.org
Subject: Re: [PATCH] add a 'pre-push' hook
Date: Tue, 19 Aug 2008 15:23:24 -0700 [thread overview]
Message-ID: <7vljysy78j.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <d411cc4a0808191445o22eb57b5tfaa37d715524f55a@mail.gmail.com> (Scott Chacon's message of "Tue, 19 Aug 2008 14:45:29 -0700")
"Scott Chacon" <schacon@gmail.com> writes:
> On Tue, Aug 19, 2008 at 2:26 PM, しらいしななこ <nanako3@lavabit.com> wrote:
>> Quoting Scott Chacon <schacon@gmail.com>:
>>
>>> 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.
>
> 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'?
[jc: trimmed excessive quotes --- please don't quote e-mail sigs]
The primary reason I said it would be a good thing to have is that it
could be common enough.
On one hand, the fact that this pre-push proposal came very late after
everybody used "git push" for eternity might mean that this is not common
requirement at all, and the wrapper approach Shawn and Jeff suggested may
be the right thing to do for minorities who want it.
The pre-commit hook has a good reason behind its existence than merely
being a "pre-something" hook that interferes. If you only think about
"git commit -a" run by the end user, yes, the whole working tree can be
validated by your wrapper script before making the commit without any need
for a hook, but the user can also say "git commit this-path-only" and give
other options, and at that point, a wrapper approach would not fly well
unless your wrapper simulates what the underlying "git commit" would do
given the set of parameters.
Similarly, a pre-push hook, if done correctly, needs to see what is about
to be pushed (e.g. the user may only say "git push" without saying where
to push to and what ref to update with which commit) to base its
validation decision on, but that cannot be easily checked without actually
simulating the push. IOW, it has criteria (2) component in it as well,
just like pre-commit hook does.
next prev parent reply other threads:[~2008-08-19 22:25 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1219170876-46893-1-git-send-email-schacon@gmail.com>
2008-08-19 18:55 ` [PATCH] add a 'pre-push' hook Scott Chacon
2008-08-19 18:58 ` Jeff King
2008-08-19 19:00 ` Scott Chacon
2008-08-19 19:08 ` Jeff King
2008-08-19 19:59 ` Shawn O. Pearce
2008-08-19 20:26 ` Scott Chacon
2008-08-19 21:26 ` しらいしななこ
2008-08-19 21:45 ` Scott Chacon
2008-08-19 22:23 ` Junio C Hamano [this message]
2008-08-19 22:26 ` Sam Vilain
2008-08-20 0:15 ` Jeff King
2008-08-19 19:39 ` Junio C Hamano
2008-08-19 19:58 ` Scott Chacon
2008-08-19 23:35 ` Junio C Hamano
2008-08-19 23:39 ` Shawn O. Pearce
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vljysy78j.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=nanako3@lavabit.com \
--cc=peff@peff.net \
--cc=schacon@gmail.com \
--cc=spearce@spearce.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox