All of lore.kernel.org
 help / color / mirror / Atom feed
From: AbdAlRahman Gad <abdobngad@gmail.com>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH v4 2/8] [Newcomer] t7004: Do not lose exit status to pipe
Date: Tue, 6 Aug 2024 11:38:33 +0300	[thread overview]
Message-ID: <3cba795c-631b-4e86-a1f2-ddefe76ef0f4@gmail.com> (raw)
In-Reply-To: <CAPig+cS6-gqZbJSz3wBcummyycJVudKybVZW=D33WHk-Fa9ytQ@mail.gmail.com>



On 8/6/24 06:13, Eric Sunshine wrote:
> On Mon, Aug 5, 2024 at 8:00 PM AbdAlRahman Gad <abdobngad@gmail.com> wrote:
>> Split "test-tool ... | sed" pipeline into two commands to avoid losing
>> exit status from test-tool.
>>
>> Signed-off-by: AbdAlRahman Gad <abdobngad@gmail.com>
>> ---
>> diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
>> @@ -97,7 +97,8 @@ test_expect_success 'creating a tag with --create-reflog should create reflog' '
>> -       test-tool ref-store main for-each-reflog-ent refs/tags/tag_with_reflog1 | sed -e "s/^.* //" >actual &&
>> +       test-tool ref-store main for-each-reflog-ent refs/tags/tag_with_reflog1 >actual.body &&
>> +       sed -e "s/^.*   //" actual.body >actual &&
> 
> It's not just `test_tool` we care about; we also (importantly) don't
> want to see `git` itself upstream of a pipe, and there are many such
> instances remaining in this script. Here are some common examples:
> 
>      test $(git tag -l | wc -l) -eq 0 &&
>      git cat-file tag "$1" | sed -e "/BEGIN PGP/q"
>      git tag -l | grep "^tag-one-line" >actual &&
>      forged=$(git cat-file tag ... | sed -e ... | git mktag) &&
>      git tag -l --no-sort "foo*" | sort >actual &&
> 
> By the way, these days, rather than:
> 
>      test $(git tag -l | wc -l) -eq 0 &&
> 
> we would say:
> 
>      test_stdout_line_count = 0 git tag -l &&
> 
> which nicely avoids placing `git` upstream of a pipe.

Thanks for the review. Could this be done in a separate patch series? As 
modifying a patch in the beginning of a patch series requires lots of 
time to adapt the rest of the series to the change.

  reply	other threads:[~2024-08-06  8:38 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-05 23:59 [PATCH v4 0/8] t7004: Modernize the style AbdAlRahman Gad
2024-08-05 23:59 ` [PATCH v4 1/8] [Newcomer] t7004: Remove space after redirect operators AbdAlRahman Gad
2024-08-05 23:59 ` [PATCH v4 2/8] [Newcomer] t7004: Do not lose exit status to pipe AbdAlRahman Gad
2024-08-06  3:13   ` Eric Sunshine
2024-08-06  8:38     ` AbdAlRahman Gad [this message]
2024-08-06 18:05       ` Eric Sunshine
2024-08-05 23:59 ` [PATCH v4 3/8] [Newcomer] t7004: One command per line AbdAlRahman Gad
2024-08-05 23:59 ` [PATCH v4 4/8] [Newcomer] t7004: Do not prepare things outside test_expect_success AbdAlRahman Gad
2024-08-06  3:29   ` Eric Sunshine
2024-08-06  8:41     ` AbdAlRahman Gad
2024-08-05 23:59 ` [PATCH v4 5/8] [Newcomer] t7004: Use indented here-doc AbdAlRahman Gad
2024-08-05 23:59 ` [PATCH v4 6/8] [Newcomer] t7004: Description on the same line as test_expect_success AbdAlRahman Gad
2024-08-05 23:59 ` [PATCH v4 7/8] [Newcomer] t7004: test Description and test body seperated with backslash AbdAlRahman Gad
2024-08-05 23:59 ` [PATCH v4 8/8] [Newcomer] t7004: Use single quotes instead of double quotes AbdAlRahman Gad
2024-08-06  3:02   ` Eric Sunshine
2024-08-06 10:10     ` AbdAlRahman Gad
2024-08-06 17:21       ` Eric Sunshine
2024-08-06 16:35     ` Junio C Hamano
2024-08-06 17:11       ` Eric Sunshine
2024-08-06  0:45 ` [PATCH v4 0/8] t7004: Modernize the style Junio C Hamano
2024-08-06  8:44   ` AbdAlRahman Gad

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3cba795c-631b-4e86-a1f2-ddefe76ef0f4@gmail.com \
    --to=abdobngad@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=sunshine@sunshineco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.