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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 29, 2016 at 01:29:33PM +0530, Pranit Bauva wrote:
> Hey Eduardo,
> 
> On Thu, Dec 29, 2016 at 12:49 AM, Eduardo Habkost <ehabkost@xxxxxxxxxx> 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



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]