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

Re: [RFC PATCH v2 3/4] t7006-pager.sh: more lenient trace checking

From
PWPhillip Wood <phillip.wood123@gmail.com>
Date
Apr 23, 2021, 12:45 UTC
Message-ID
<27d2ffe7-6f5b-726e-eed0-438a4efb8f9f@gmail.com>
In-Reply-To
<f4c3688e-8316-7f66-3bcb-d8aaeef3a7d3@gmail.com>
Hi Emily
On 23/04/2021 10:54, Phillip Wood wrote:
Show 18 quoted lines
> Hi Emily
> [...]
>> diff --git a/t/t7006-pager.sh b/t/t7006-pager.sh
>> index 0e7cf75435..ac2d91d56b 100755
>> --- a/t/t7006-pager.sh
>> +++ b/t/t7006-pager.sh
>> @@ -676,7 +676,9 @@ test_expect_success TTY 'git returns SIGPIPE on 
>> early pager exit' '
>>           test_terminal git log
>>       fi &&
>> -    grep child_exit trace.normal >child-exits &&
>> +    PAGER_CHILD_ID=$(grep pager-used trace.normal | \
>> +             sed -n "s/child_start\[\([0-9]\+\)\].*/\1/p") &&
> 
> If you want to save a process you could use sed to do the job of the 
> grep command. I think this should do it
> 
> sed -n -e "/child_exit/ {" -e "s/child_start\[\([0-9]\+\)\].*/\1/p" -e "}"

I must have been half asleep when I wrote that, there is no need for the braces and the initial match is wrong it should be

sed -n "/pager-used/s/child_start\[\([0-9]\+\)\].*/\1/p"
Best Wishes
Phillip
Show 68 quoted lines
>> +    grep -F "child_exit["$PAGER_CHILD_ID"]" trace.normal >child-exits &&
> 
> Why is $PAGER_CHILD_ID unquoted?
> 
> Best Wishes
> 
> Phillip
> 
>>       test_line_count = 1 child-exits &&
>>       grep " code:0 " child-exits &&
>>       test_path_is_file pager-used
>> @@ -697,7 +699,9 @@ test_expect_success TTY 'git returns SIGPIPE on 
>> early pager non-zero exit' '
>>           test_terminal git log
>>       fi &&
>> -    grep child_exit trace.normal >child-exits &&
>> +    PAGER_CHILD_ID=$(grep pager-used trace.normal | \
>> +             sed -n "s/child_start\[\([0-9]\+\)\].*/\1/p") &&
>> +    grep -F "child_exit["$PAGER_CHILD_ID"]" trace.normal >child-exits &&
>>       test_line_count = 1 child-exits &&
>>       grep " code:1 " child-exits &&
>>       test_path_is_file pager-used
>> @@ -718,7 +722,9 @@ test_expect_success TTY 'git discards pager 
>> non-zero exit without SIGPIPE' '
>>           test_terminal git log
>>       fi &&
>> -    grep child_exit trace.normal >child-exits &&
>> +    PAGER_CHILD_ID=$(grep pager-used trace.normal | \
>> +             sed -n "s/child_start\[\([0-9]\+\)\].*/\1/p") &&
>> +    grep -F "child_exit["$PAGER_CHILD_ID"]" trace.normal >child-exits &&
>>       test_line_count = 1 child-exits &&
>>       grep " code:1 " child-exits &&
>>       test_path_is_file pager-used
>> @@ -739,7 +745,9 @@ test_expect_success TTY 'git discards nonexisting 
>> pager without SIGPIPE' '
>>           test_terminal git log
>>       fi &&
>> -    grep child_exit trace.normal >child-exits &&
>> +    PAGER_CHILD_ID=$(grep does-not-exist trace.normal | \
>> +             sed -n "s/child_start\[\([0-9]\+\)\].*/\1/p") &&
>> +    grep -F "child_exit["$PAGER_CHILD_ID"]" trace.normal >child-exits &&
>>       test_line_count = 1 child-exits &&
>>       grep " code:127 " child-exits &&
>>       test_path_is_file pager-used
>> @@ -760,7 +768,9 @@ test_expect_success TTY 'git attempts to page to 
>> nonexisting pager command, gets
>>           test_terminal git log
>>       fi &&
>> -    grep child_exit trace.normal >child-exits &&
>> +    PAGER_CHILD_ID=$(grep does-not-exist trace.normal | \
>> +             sed -n "s/child_start\[\([0-9]\+\)\].*/\1/p") &&
>> +    grep -F "child_exit["$PAGER_CHILD_ID"]" trace.normal >child-exits &&
>>       test_line_count = 1 child-exits &&
>>       grep " code:-1 " child-exits
>>   '
>> @@ -780,7 +790,9 @@ test_expect_success TTY 'git returns SIGPIPE on 
>> propagated signals from pager' '
>>           test_terminal git log
>>       fi &&
>> -    grep child_exit trace.normal >child-exits &&
>> +    PAGER_CHILD_ID=$(grep pager-used trace.normal | \
>> +             sed -n "s/child_start\[\([0-9]\+\)\].*/\1/p") &&
>> +    grep -F "child_exit["$PAGER_CHILD_ID"]" trace.normal >child-exits &&
>>       test_line_count = 1 child-exits &&
>>       grep " code:143 " child-exits &&
>>       test_path_is_file pager-used
>>
> 
Previous: Phillip WoodNext: Emily Shaffer
Message 20 of 22 in “share a config between submodule and superproject”
  1. 0/2 share a config between submodule and superprojectEmily Shaffer, Apr 8, 2021
  2. 1/2 config: rename "submodule" scope to "gitmodules"Emily Shaffer, Apr 8, 2021
  3. 2/2 config: add 'config.superproject' fileEmily Shaffer, Apr 8, 2021
  4. Philip OakleyApr 9, 2021
  5. Emily ShafferApr 13, 2021
  6. Matheus Tavares BernardinoApr 9, 2021
  7. Junio C HamanoApr 9, 2021
  8. Emily ShafferApr 13, 2021
  9. Emily ShafferApr 13, 2021
  10. Future structure of submodules and .git/, .git/modules/* organizationÆvar Arnfjörð Bjarmason, Apr 14, 2021
  11. Emily ShafferApr 15, 2021
  12. Junio C HamanoApr 15, 2021
  13. 0/4 share a config between submodule and superprojectEmily Shaffer, Apr 23, 2021
  14. 1/4 config: rename "submodule" scope to "gitmodules"Emily Shaffer, Apr 23, 2021
  15. Phillip WoodApr 23, 2021
  16. 2/4 t1510-repo-setup: don't use exact matching on tracesEmily Shaffer, Apr 23, 2021
  17. Phillip WoodApr 23, 2021
  18. 3/4 t7006-pager.sh: more lenient trace checkingEmily Shaffer, Apr 23, 2021
  19. Phillip WoodApr 23, 2021
  20. Phillip WoodApr 23, 2021
  21. 4/4 config: add 'config.superproject' fileEmily Shaffer, Apr 23, 2021
  22. Johannes SchindelinApr 23, 2021

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.