All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Thierry Reding <thierry.reding@gmail.com>
Cc: git@vger.kernel.org, Taylor Blau <me@ttaylorr.com>
Subject: Re: [PATCH v3] am: Allow passing --no-verify flag
Date: Tue, 29 Nov 2022 10:20:05 +0900	[thread overview]
Message-ID: <xmqqv8my4kvu.fsf@gitster.g> (raw)
In-Reply-To: <20221128174825.1510407-1-thierry.reding@gmail.com> (Thierry Reding's message of "Mon, 28 Nov 2022 18:48:25 +0100")

Thierry Reding <thierry.reding@gmail.com> writes:

> +test_expect_success 'am with failing applypatch-msg hook (no verify)' '
> +	rm -fr .git/rebase-apply &&
> +	git reset --hard &&
> +	git checkout first &&
> +	test_hook applypatch-msg <<-\EOF &&
> +	exit 1
> +	EOF
> +	git am --no-verify patch1
> +'
> +
>  test_expect_success 'am with pre-applypatch hook' '
>  	rm -fr .git/rebase-apply &&
>  	git reset --hard &&
> @@ -374,6 +384,16 @@ test_expect_success 'am with failing pre-applypatch hook' '
>  	test_cmp_rev first HEAD
>  '
>  
> +test_expect_success 'am with failing pre-applypatch hook (no verify)' '
> +	rm -fr .git/rebase-apply &&
> +	git reset --hard &&
> +	git checkout first &&
> +	test_hook pre-applypatch <<-\EOF &&
> +	exit 1
> +	EOF
> +	git am --no-verify patch1
> +'
> +
>  test_expect_success 'am with post-applypatch hook' '
>  	rm -fr .git/rebase-apply &&
>  	git reset --hard &&

These two tests will still pass if you change the implementation to
run the hook and simply ignore its exit status, but I recall you
making a good argument against that alternative implementation ,in
comparison to "not running the hook at all".

I think these tests should make sure that the hooks did not even
run.  Perhaps by creating a marker file before running "git am",
adding a "rm" that marker file in the hook, and making sure that
the marker file still exists after "git am" returns, or something
like that.

  parent reply	other threads:[~2022-11-29  1:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-28 17:48 [PATCH v3] am: Allow passing --no-verify flag Thierry Reding
2022-11-28 23:07 ` Taylor Blau
2022-11-29 10:02   ` Thierry Reding
2022-11-29  1:20 ` Junio C Hamano [this message]
2022-11-29 10:03   ` Thierry Reding

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=xmqqv8my4kvu.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=me@ttaylorr.com \
    --cc=thierry.reding@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.