Thread (1 message) 1 message, 1 author, 2016-06-15

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

From: Eric Sunshine <hidden>
Date: 2016-06-15 23:09:04

[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 [off-list ref] wrote:
On Sun, Mar 27, 2016 at 5:05 AM, Pranit Bauva [off-list ref] wrote:
quoted
On Sun, Mar 27, 2016 at 12:40 PM, Eric Sunshine [off-list ref] wrote:
quoted
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).
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help