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

Re: [PATCH v2] t9116: avoid using pipes

From
Shanthanu <shanthanu.s.rai9@gmail.com>
Date
Mar 25, 2020, 14:00 UTC
Message-ID
<4b40a756-c32f-64ad-1e1d-4e31804d8295@gmail.com>
In-Reply-To
<CAP8UFD2Uu-dPJcZB--T7k0tMuXc0iVeqnMUn3Y_x+3iaFf9xFQ@mail.gmail.com>
On 25/03/20 12:04 am, Christian Couder wrote:
Show 14 quoted lines
> On Tue, Mar 24, 2020 at 10:36 AM Shanthanu <shanthanu.s.rai9@gmail.com> wrote:
>> Commit c6f44e1da5 (t9813: avoid using pipes, 2017-01-04) recommends to
>> avoid using pipes, since the exit code of upstream in the pipe is
>> ignored. Hence, redirect the output to a file and parse that file.
>>
>> Commit de26f02db1 (t9001, t9116: avoid pipes, 2020-02-14) noted that
>> this also allows easy debugging in case the test fails, since the file
>> will be left on disk and can be manually inspected.
>>
>> Signed-off-by: Shanthanu <shanthanu.s.rai9@gmail.com>
> We usually ask for a legal name in a format similar to "<Firstname>
> <MaybeMiddleNameInitial> <Lastname>" where <MaybeMiddleNameInitial>
> can be omitted. The name should also match what is in the "From:"
> field of the emails you send.
Okay, I will keep that in mind.
Show 20 quoted lines
>> ---
>>  t/t9116-git-svn-log.sh | 53 +++++++++++++++++++++++++++++++-----------
>>  1 file changed, 39 insertions(+), 14 deletions(-)
>>
>> diff --git a/t/t9116-git-svn-log.sh b/t/t9116-git-svn-log.sh
>> index 0a9f1ef366..56d68e4aed 100755
>> --- a/t/t9116-git-svn-log.sh
>> +++ b/t/t9116-git-svn-log.sh
>> @@ -61,12 +61,16 @@ printf 'r1 \nr2 \nr4 \n' > expected-range-r1-r2-r4
>>
>>  test_expect_success 'test ascending revision range' "
>>         git reset --hard origin/trunk &&
>> -       git svn log -r 1:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2-r4 -
>> +       git svn log -r 1:4 >out &&
>> +       grep '^r[0-9]' out | cut -d'|' -f1 >actual &&
>> +       test_cmp expected-range-r1-r2-r4 actual
>>         "
> It seems that the code that your patch changes is repeated a lot in
> this test script. I wonder if it would be better to write a shell
> function to avoid those repetitions.

Oh yeah, that would be better. I will add a function. Just clarifying, the function should run the git, grep, cut and test_cmp commands?

Also, could you suggest an appropriate name for this function?
Previous: Christian Couder
Message 7 of 7 in “Microproject Submission”
  1. ShanthanuMar 22, 2020
  2. [GSoC][PATCH 1/1] t9116: avoid using pipesShanthanu, Mar 22, 2020
  3. Torsten BögershausenMar 22, 2020
  4. ShanthanuMar 23, 2020
  5. t9116: avoid using pipesShanthanu, Mar 24, 2020
  6. Christian CouderMar 24, 2020
  7. ShanthanuMar 25, 2020

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.