Re: [PATCH v10 2/3] t7507-commit-verbose: store output of grep in a file

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

 



[forwarding this to the list, as well, since I again didn't notice
when replying that Pranit had accidentally dropped the mailing list as
a recipient]

On Sun, Mar 27, 2016 at 12:59 PM, Eric Sunshine <sunshine@xxxxxxxxxxxxxx> wrote:
> On Sun, Mar 27, 2016 at 5:05 AM, Pranit Bauva <pranit.bauva@xxxxxxxxx> wrote:
>> On Sun, Mar 27, 2016 at 12:40 PM, Eric Sunshine <sunshine@xxxxxxxxxxxxxx> wrote:
>>> However, even if you take the approach of making 'check-for-diff'
>>> succeed unconditionally and always count diffs, the current
>>> implementation is still overly complicated. It would be much simpler
>>> to let 'check-for-diff' always create the output file, and then use
>>> "test_line_count = 0 out" when expecting no diffs than to sometimes
>>> create the output file and sometimes not. The shell '>' operator will
>>> truncate the file to zero size even before grep is invoked, so you
>>> don't need to worry that results from an earlier test will pollute
>>> 'out' for a subsequent test, even if grep finds no matches. Thus,
>>> 'check-for-diff' collapses to this tiny implementation:
>>>
>>>     grep '^diff --git' "$1" >out
>>>     exit 0
>>>
>>> Or, if you want to be terse:
>>>
>>>     grep '^diff --git' "$1" || exit 0 >out
>>
>> I tried using both of this and it gives an error
>
> These worked fine for me when I rewrote the test script before making
> the suggestion. You'll need to provide more information if you want to
> get to the bottom of the problem you experienced (for instance, show
> the exact code you used and the actual error message).
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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]