git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Aaron Schrab <aaron@schrab.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH v2 0/3] pre-push hook support
Date: Mon, 14 Jan 2013 16:24:00 -0800	[thread overview]
Message-ID: <7vpq1770pr.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <7va9sb8jg7.fsf@alter.siamese.dyndns.org> (Junio C. Hamano's message of "Mon, 14 Jan 2013 14:54:00 -0800")

Junio C Hamano <gitster@pobox.com> writes:

> Junio C Hamano <gitster@pobox.com> writes:
>
>> Aaron Schrab <aaron@schrab.com> writes:
>>
>>> Main changes since the initial version:
>>>
>>>  * The first patch converts the existing hook callers to use the new
>>>    find_hook() function.
>>>  * Information about what is to be pushed is now sent over a pipe rather
>>>    than passed as command-line parameters.
>>>
>>> Aaron Schrab (3):
>>>   hooks: Add function to check if a hook exists
>>>   push: Add support for pre-push hooks
>>>   Add sample pre-push hook script
>>
>> Getting much nicer.  Thanks.
>
> Hmph, t5571 seems to be flaky in that it sometimes fails but passes
> when run again.  Something timing dependent is going on???

With this patch applied, repeatedly try to

 - make sure "foreign" ref does not exist; and
 - attempt pushing the HEAD:foreign to create the "foreign" ref

until it fails, I can get it stop before the output scrolls off of
my 114 line terminal.  Then when I revert the changes to transport.[ch]
and builtin/push.c in this series, the test will keep going.

Wait.  The sample hook used in the test _is_ fed some input but it
exits without reading any.  What happens when we fork it, and it
completes execution before we even have a chance to feed a single
byte?  Wont' we get a sigpipe and die?

Yup, I think that is what is missing from run_pre_push_hook()
implementation.

diff --git a/t/t5571-pre-push-hook.sh b/t/t5571-pre-push-hook.sh
index d68fed7..050318b 100755
--- a/t/t5571-pre-push-hook.sh
+++ b/t/t5571-pre-push-hook.sh
@@ -16,8 +16,15 @@ test_expect_success 'setup' '
 	git init --bare repo1 &&
 	git remote add parent1 repo1 &&
 	test_commit one &&
-	git push parent1 HEAD:foreign
+	while :
+	do
+		git push parent1 :refs/heads/foreign &&
+		git push parent1 HEAD:foreign || break
+	done
 '
+
+exit
+
 write_script "$HOOK" <<EOF
 exit 1
 EOF

  reply	other threads:[~2013-01-15  0:24 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-28 22:57 [PATCH 0/4] pre-push hook support Aaron Schrab
2012-12-28 22:57 ` [PATCH 1/4] hooks: Add function to check if a hook exists Aaron Schrab
2012-12-29  2:08   ` Junio C Hamano
2012-12-29 14:50     ` Aaron Schrab
2012-12-29 16:54       ` Junio C Hamano
2012-12-28 22:57 ` [PATCH 2/4] hooks: support variable number of parameters Aaron Schrab
2012-12-28 22:57 ` [PATCH 3/4] push: Add support for pre-push hooks Aaron Schrab
2012-12-28 22:57 ` [PATCH 4/4] Add sample pre-push hook script Aaron Schrab
2012-12-29  2:01 ` [PATCH 0/4] pre-push hook support Junio C Hamano
2012-12-29 14:50   ` Aaron Schrab
2012-12-29 16:48     ` Junio C Hamano
2013-01-13  5:17 ` [PATCH v2 0/3] " Aaron Schrab
2013-01-14 17:42   ` Junio C Hamano
2013-01-14 22:54     ` Junio C Hamano
2013-01-15  0:24       ` Junio C Hamano [this message]
2013-01-13  5:17 ` [PATCH v2 1/3] hooks: Add function to check if a hook exists Aaron Schrab
2013-01-13  5:17 ` [PATCH v2 2/3] push: Add support for pre-push hooks Aaron Schrab
2013-01-14 17:39   ` Junio C Hamano
2013-01-15  0:36   ` Junio C Hamano
2013-01-15  3:12     ` Junio C Hamano
2013-01-13  5:17 ` [PATCH v2 3/3] Add sample pre-push hook script Aaron Schrab
2013-01-14 17:42   ` Junio C Hamano

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vpq1770pr.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=aaron@schrab.com \
    --cc=git@vger.kernel.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).