From: Chizoba ODINAKA <chizobajames21@gmail.com>
To: phillip.wood@dunelm.org.uk
Cc: git@vger.kernel.org, ps@pks.im
Subject: Re: [Outreachy][PATCH v2] t6050: avoid pipes with downstream Git commands
Date: Thu, 10 Oct 2024 19:51:31 +0100 [thread overview]
Message-ID: <CACwP9aqEoRchNN-4iuSxrhtt5k-yHMsjmyQjaG9uV4xUsQ7geg@mail.gmail.com> (raw)
In-Reply-To: <90dea722-0762-4a37-a216-6883f4889c67@gmail.com>
Hi Philip,
On Thu, 10 Oct 2024 at 15:08, Phillip Wood <phillip.wood123@gmail.com> wrote:
>
> Hi Chizoba
>
> On 10/10/2024 07:39, chizobajames21@gmail.com wrote:
> > From: Chizoba ODINAKA <chizobajames21@gmail.com>
> >
> > In pipes, the exit code of a chain of commands is determined by
> > the downstream command.
>
> I would perhaps say "final command" rather than "downstream command" as
> in a pipeline "cmd1 | cmd2 | cmd3" cmd2 and cmd3 are downstream of cmd1
> but it is the exit code of cmd3 that will be used
>
Yes, final command is a more appropriate explain.
> > In order not to loss the entire result code of tests,
> > write output of upstreams into a file.
>
> We're interested in checking the exit code of git, but not other
> commands so it would be helpful to make that clear. Usman's patch [1]
> has a good explanation of this.
>
I just read that sentence again, it obviously needs some clarity. "In order not
to miss the exit code of any Git command, avoid using pipe and write
output into a file"
has more clarity. I will look up on Usman's patch [1], before my next changes.
> This patch also changes instances of "grep" to "test_grep" so the commit
> message needs to explain the reason for that change which is that it
> gives a better debugging experience if the test fails.
>
I had included that in my "Changes in v2", appended beneath my "Sign-off-by".
"Changes in v2:
- split multiple commands chain on the same line across multiple line,
for easier readability
- replace "grep" with "test_grep", for more context in case of a "grep"
failure"
Maybe it was not so obvious that you didn't notice, or it is not the
traditional way of including it.
> The patch is looking pretty good, most of the conversions look correct.
> I've left a few comments below
>
>
> [1]
> https://lore.kernel.org/git/bfff7937cd20737bb5a8791dc7492700b1d7881f.1728315124.git.gitgitgadget@gmail.com
>
> > test_expect_success 'replace the author' '
> > - git cat-file commit $HASH2 | grep "author A U Thor" &&
> > - R=$(git cat-file commit $HASH2 | sed -e "s/A U/O/" | git hash-object -t commit --stdin -w) &&
> > - git cat-file commit $R | grep "author O Thor" &&
> > + git cat-file commit $HASH2 >actual &&
> > + test_grep "author A U Thor" actual &&
> > + git cat-file commit $HASH2 >actual &&
>
> You don't need to repeat this command now that we are saving the output
> of "git cat-file commit $HASH2"
>
> > + R=$(sed -e "s/A U/O/" actual | git hash-object -t commit --stdin -w) &&
> > + git cat-file commit $R >actual &&
> > + test_grep "author O Thor" actual &&
>
> > test_expect_success 'push branch with replacement' '
> > - git cat-file commit $PARA3 | grep "author A U Thor" &&
> > - S=$(git cat-file commit $PARA3 | sed -e "s/A U/O/" | git hash-object -t commit --stdin -w) &&
> > - git cat-file commit $S | grep "author O Thor" &&
> > + git cat-file commit $PARA3 >actual &&
> > + test_grep "author A U Thor" actual &&
> > + git cat-file commit $PARA3 >actual &&
>
> We can drop this line for the same reason as above
>
> > + S=$(sed -e "s/A U/O/" actual | git hash-object -t commit --stdin -w) &&
> > + git cat-file commit $S >actual &&
> > + test_grep "author O Thor" actual &&
>
> > @@ -260,14 +291,14 @@ test_expect_success 'fetch branch with replacement' '
> > cd clone_dir &&
> > git fetch origin refs/heads/tofetch:refs/heads/parallel3 &&
> > git log --pretty=oneline parallel3 >output.txt &&
> > - ! grep $PARA3 output.txt &&
> > + ! test_grep $PARA3 output.txt &&
>
> test_grep will print an error message the pattern does not match. In
> this case we expect it not to match so we want to print an error if it
> does match. We can do that with
>
> test_grep ! $PARA3 output.txt &&
>
> > test_expect_success 'index-pack and replacements' '
> > - git --no-replace-objects rev-list --objects HEAD |
> > + git --no-replace-objects rev-list --objects HEAD >actual &&
> > git --no-replace-objects pack-objects test- &&
>
> This command has lost its input - you need to use '<actual' to get it to
> read output from "git rev-list". This test itself could probably do a
> better job of checking that index-pack does what we expect but that is
> outside the scope of this patch.
>
> > git index-pack test-*.pack
> > '
>
> Everything that I've not commented on looks correct to me.
>
Thanks Philip for the review, I will make the needed changes in my
next patch. And look into
the index-pack proposal in a new patch, since it is outside this scope.
> Best Wishes
>
> Phillip
Thanks
Chizoba
next prev parent reply other threads:[~2024-10-10 18:51 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-08 16:21 [Outreachy][PATCH] t6050: avoid pipes in git related commands chizobajames21
2024-10-09 7:28 ` Patrick Steinhardt
2024-10-10 7:26 ` Chizoba ODINAKA
2024-10-10 6:39 ` [Outreachy][PATCH v2] t6050: avoid pipes with downstream Git commands chizobajames21
2024-10-10 14:08 ` Phillip Wood
2024-10-10 18:51 ` Chizoba ODINAKA [this message]
2024-10-11 9:17 ` phillip.wood123
2024-10-11 15:45 ` [Outreachy][PATCH v3] " chizobajames21
2024-10-11 16:02 ` Junio C Hamano
2024-10-11 16:03 ` Eric Sunshine
2024-10-11 17:49 ` Junio C Hamano
2024-10-11 23:59 ` [Outreachy][PATCH v4] t6050: avoid pipes with upstream " chizobajames21
2024-10-12 5:35 ` Eric Sunshine
2024-10-12 6:28 ` Chizoba ODINAKA
2024-10-12 6:21 ` [Outreachy][PATCH v5] " chizobajames21
2024-10-14 14:00 ` Phillip Wood
2024-10-14 15:27 ` Chizoba ODINAKA
2024-10-14 15:24 ` [Outreachy][PATCH v6] " chizobajames21
2024-10-14 21:57 ` Taylor Blau
2024-10-15 11:07 ` Chizoba ODINAKA
2024-10-15 11:26 ` [Outreachy][PATCH v7] " chizobajames21
2024-10-22 1:27 ` chizobajames21
2024-10-22 1:37 ` Chizoba ODINAKA
2024-10-22 5:02 ` Patrick Steinhardt
2024-10-22 16:48 ` Taylor Blau
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=CACwP9aqEoRchNN-4iuSxrhtt5k-yHMsjmyQjaG9uV4xUsQ7geg@mail.gmail.com \
--to=chizobajames21@gmail.com \
--cc=git@vger.kernel.org \
--cc=phillip.wood@dunelm.org.uk \
--cc=ps@pks.im \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).