diff mbox series

[v2,1/1] t2400: avoid using pipes

Message ID 20231130165429.2595-2-ach.lumap@gmail.com (mailing list archive)
State New, archived
Headers show
Series *** Avoid using Pipes *** | expand

Commit Message

Achu Luma Nov. 30, 2023, 4:54 p.m. UTC
The exit code of the preceding command in a pipe is disregarded,
so it's advisable to refrain from relying on it. Instead, by
saving the output of a Git command to a file, we gain the
ability to examine the exit codes of both commands separately.

Signed-off-by: achluma <ach.lumap@gmail.com>
---
 t/t2400-worktree-add.sh | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Christian Couder Nov. 30, 2023, 6:16 p.m. UTC | #1
Hi Luma,

On Thu, Nov 30, 2023 at 6:37 PM Achu Luma <ach.lumap@gmail.com> wrote:
>
> The exit code of the preceding command in a pipe is disregarded,
> so it's advisable to refrain from relying on it. Instead, by
> saving the output of a Git command to a file, we gain the
> ability to examine the exit codes of both commands separately.
>
> Signed-off-by: achluma <ach.lumap@gmail.com>

I think the issue with merging your patch (in
https://lore.kernel.org/git/xmqqedibzgi1.fsf@gitster.g/) was that this
"Signed-off-by: ..." line didn't show your full real name and didn't
match your name in your email address.

Assuming that "Achu Luma" is your full real name, you should replace
"achluma" with "Achu Luma" in the "Signed-off-by: ..." line.

Also it's better not to send a cover letter patch like
https://lore.kernel.org/git/20231130165429.2595-1-ach.lumap@gmail.com/
with no content for small patches like this.

When you resend, please also make sure to use [Outreachy] in the patch
subject and to increment the version number of the patch, using for
example "[PATCH v3]".

It would be nice too if after the line starting with --- below, you
could describe in a few lines the changes in the new version of the
patch compared to the previous version.

> ---

Here (after the line starting with --- above) is the place where you
can tell what changed in the patch compared to the previous version.

Note that when there is a cover letter patch, it's better to talk
about changes in the new version in the cover letter, but I dont think
it's worth sending a cover letter patch.

Thanks,
Christian.

>  t/t2400-worktree-add.sh | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/t/t2400-worktree-add.sh b/t/t2400-worktree-add.sh
> index df4aff7825..7ead05bb98 100755
> --- a/t/t2400-worktree-add.sh
> +++ b/t/t2400-worktree-add.sh
> @@ -468,7 +468,8 @@ test_expect_success 'put a worktree under rebase' '
>                 cd under-rebase &&
>                 set_fake_editor &&
>                 FAKE_LINES="edit 1" git rebase -i HEAD^ &&
> -               git worktree list | grep "under-rebase.*detached HEAD"
> +               git worktree list >actual &&
> +               grep "under-rebase.*detached HEAD" actual
>         )
>  '
>
> @@ -509,7 +510,8 @@ test_expect_success 'checkout a branch under bisect' '
>                 git bisect start &&
>                 git bisect bad &&
>                 git bisect good HEAD~2 &&
> -               git worktree list | grep "under-bisect.*detached HEAD" &&
> +               git worktree list >actual &&
> +               grep "under-bisect.*detached HEAD" actual &&
>                 test_must_fail git worktree add new-bisect under-bisect &&
>                 ! test -d new-bisect
>         )
> --
> 2.41.0.windows.1
>
>
diff mbox series

Patch

diff --git a/t/t2400-worktree-add.sh b/t/t2400-worktree-add.sh
index df4aff7825..7ead05bb98 100755
--- a/t/t2400-worktree-add.sh
+++ b/t/t2400-worktree-add.sh
@@ -468,7 +468,8 @@  test_expect_success 'put a worktree under rebase' '
 		cd under-rebase &&
 		set_fake_editor &&
 		FAKE_LINES="edit 1" git rebase -i HEAD^ &&
-		git worktree list | grep "under-rebase.*detached HEAD"
+		git worktree list >actual && 
+		grep "under-rebase.*detached HEAD" actual
 	)
 '
 
@@ -509,7 +510,8 @@  test_expect_success 'checkout a branch under bisect' '
 		git bisect start &&
 		git bisect bad &&
 		git bisect good HEAD~2 &&
-		git worktree list | grep "under-bisect.*detached HEAD" &&
+		git worktree list >actual && 
+		grep "under-bisect.*detached HEAD" actual &&
 		test_must_fail git worktree add new-bisect under-bisect &&
 		! test -d new-bisect
 	)