On Fri, Mar 25, 2016 at 10:46 AM, SZEDER Gábor <sze...@ira.uka.de> wrote:
> Quoting Eric Sunshine <sunsh...@sunshineco.com>:
>> On Thu, Mar 24, 2016 at 7:00 AM, SZEDER Gábor <sze...@ira.uka.de> wrote:
>>>> -cat >check-for-diff <<EOF
>>>> -#!$SHELL_PATH
>>>> -exec grep '^diff --git' "\$1"
>>>> +write_script "check-for-diff" <<-\EOF &&
>>>> +grep '^diff --git' "$1" >out &&
>>>> +test $(wc -l <out) = 1
>>>
>>> Our test lib offers the test_line_count helper function, which
>>> outputs a helpful error message in case the number of lines do not
>>> match.
>>
>> test_line_count() was mentioned in [2], however, this line counting is
>> done in the fake "editor" script, not in the test script proper, so
>> the spelled-out form $(wc ...) was proposed[2].
>
> Ah, yes, of course.
>
> But then the question is: why is the line counting in the editor script
> in the first place?
>
> By redirecting grep's output to a file in the editor script, like this
> patch wanted to, we can count the lines in the test script itself after
> 'git commit' finished.  This way we could use test_line_count, with
> all its error reporting benefits, and we could use the same editor
> script for all tests.

That works too, simplifying the overall implementation, and
eliminating the need for the introductory patch which moves
'test_set_editor' into each test.

> And if you insist on doing the line counting in the editor script, then
> why redirecting grep's output and 'wc -l' separately, why not 'grep -c'?

Ugh, I utterly forgot about -c.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to