From: Ayush Chandekar <ayu.chandekar@gmail.com>
To: gitster@pobox.com
Cc: ayu.chandekar@gmail.com, git@vger.kernel.org, sunshine@sunshineco.com
Subject: [GSOC][PATCH v2] t6422: avoid suppressing Git’s exit code in tests
Date: Wed, 5 Feb 2025 19:58:17 +0530 [thread overview]
Message-ID: <20250205142817.42117-1-ayu.chandekar@gmail.com> (raw)
In-Reply-To: <xmqqjza5x3go.fsf@gitster.g>
Some test in t6423 supress Git's exit code, which can cause test
failures go unnoticed. Specifically using git <subcommand> |
<other-command> masks potential failures of the Git command.
Instead of executing a Git command as the upstream component of
a pipe, which can result in the exit status being lost, redirect
its output to a file and then process that file in two steps to
ensure the exit status is properly preserved.
Signed-off-by: Ayush Chandekar <ayu.chandekar@gmail.com>
---
t/t6423-merge-rename-directories.sh | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/t/t6423-merge-rename-directories.sh b/t/t6423-merge-rename-directories.sh
index 88d1cf2cde..a6c5b5a494 100755
--- a/t/t6423-merge-rename-directories.sh
+++ b/t/t6423-merge-rename-directories.sh
@@ -5071,7 +5071,8 @@ test_expect_success '12i: Directory rename causes rename-to-self' '
test_path_is_file source/bar &&
test_path_is_file source/baz &&
- git ls-files | uniq >tracked &&
+ git ls-files >actual &&
+ uniq actual >tracked &&
test_line_count = 3 tracked &&
git status --porcelain -uno >actual &&
@@ -5129,7 +5130,8 @@ test_expect_success '12j: Directory rename to root causes rename-to-self' '
test_path_is_file bar &&
test_path_is_file baz &&
- git ls-files | uniq >tracked &&
+ git ls-files >actual &&
+ uniq actual >tracked &&
test_line_count = 3 tracked &&
git status --porcelain -uno >actual &&
@@ -5187,7 +5189,8 @@ test_expect_success '12k: Directory rename with sibling causes rename-to-self' '
test_path_is_file dirA/bar &&
test_path_is_file dirA/baz &&
- git ls-files | uniq >tracked &&
+ git ls-files >actual &&
+ uniq actual >tracked &&
test_line_count = 3 tracked &&
git status --porcelain -uno >actual &&
--
2.48.GIT
next prev parent reply other threads:[~2025-02-05 14:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-02 12:09 [PATCH] t6423: fix suppression of Git’s exit code in tests ayu-ch
2025-02-02 13:18 ` Meet Soni
2025-02-02 13:35 ` Eric Sunshine
2025-02-03 0:04 ` Junio C Hamano
2025-02-04 0:38 ` Ayush Chandekar
2025-02-04 13:08 ` Junio C Hamano
2025-02-05 14:28 ` Ayush Chandekar [this message]
2025-02-05 20:47 ` [GSOC][PATCH v2] t6422: avoid suppressing " Junio C Hamano
2025-02-06 5:08 ` [GSOC][PATCH v2] t6423: " Ayush Chandekar
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=20250205142817.42117-1-ayu.chandekar@gmail.com \
--to=ayu.chandekar@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--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 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).