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

Re: [PATCH v2] am: add am.signoff add config variable

From
EHEduardo Habkost <ehabkost@redhat.com>
Date
Dec 29, 2016, 15:37 UTC
Message-ID
<20161229153709.GA23595@thinpad.lan.raisama.net>
In-Reply-To
<CAFZEwPOPMrCXTc+SMhjGSnPKLmefcde4MgJsz7n5rBApACZOug@mail.gmail.com>
On Thu, Dec 29, 2016 at 01:29:33PM +0530, Pranit Bauva wrote:
Show 24 quoted lines
> Hey Eduardo,
> 
> On Thu, Dec 29, 2016 at 12:49 AM, Eduardo Habkost <ehabkost@redhat.com> wrote:
> >> test_expect_success '--no-signoff overrides am.signoff' '
> >>       rm -fr .git/rebase-apply &&
> >>       git reset --hard first &&
> >>       test_config am.signoff true &&
> >>       git am --no-signoff <patch2 &&
> >>       printf "%s\n" "$signoff" >expected &&
> >>       git cat-file commit HEAD^ | grep "Signed-off-by:" >actual &&
> >>       test_cmp expected actual &&
> >>       git cat-file commit HEAD | grep "Signed-off-by:" >actual &&
> >>       test_must_be_empty actual
> >> '
> >>
> >> The test fails because the second "grep" command returns a
> >> non-zero exit code. Any suggestions to avoid that problem in a
> >> more idiomatic way?
> >
> > I just found out that "test_must_fail grep ..." is a common
> > idiom, so what about:
> 
> Is there any particular reason to use "grep" instead of "test_cmp"? To
> check for non-zero error code, you can always use "! test_cmp".

The test code is checking only the "Signed-off-by" lines, not the whole commit message. "test_cmp" would require recovering the entire contents of the original commit message, which would add complexity to the test code.

-- 
Eduardo
Previous: Pranit BauvaNext: Andreas Schwab
Message 7 of 9 in “am: add am.signoff add config variable”
  1. am: add am.signoff add config variableEduardo Habkost, Dec 28, 2016
  2. Stefan BellerDec 28, 2016
  3. Eduardo HabkostDec 28, 2016
  4. Eduardo HabkostDec 28, 2016
  5. Stefan BellerDec 28, 2016
  6. Pranit BauvaDec 29, 2016
  7. Eduardo HabkostDec 29, 2016
  8. Andreas SchwabDec 28, 2016
  9. Eduardo HabkostDec 28, 2016

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.