git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3] am: Allow passing --no-verify flag

From
TRThierry Reding <thierry.reding@gmail.com>
Date
Nov 29, 2022, 10:03 UTC
Message-ID
<Y4XY/tUT+vKOrabX@orome>
In-Reply-To
<xmqqv8my4kvu.fsf@gitster.g>
On Tue, Nov 29, 2022 at 10:20:05AM +0900, Junio C Hamano wrote:
Show 43 quoted lines
> 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.

All good points. I've updated both tests to check that patches have been applied correctly and that the scripts haven't been run.

Thierry
Previous: Junio C Hamano
Message 5 of 5 in “am: Allow passing --no-verify flag”
  1. am: Allow passing --no-verify flagThierry Reding, Nov 28, 2022
  2. Taylor BlauNov 28, 2022
  3. Thierry RedingNov 29, 2022
  4. Junio C HamanoNov 29, 2022
  5. Thierry RedingNov 29, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.