public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
From: amisha <amishhhaaaa@gmail.com>
To: git@vger.kernel.org
Cc: amishhhaaaa@gmail.com
Subject: [PATCH] t0100: avoid suppressing git exit code
Date: Tue, 13 Jan 2026 23:34:09 +0530	[thread overview]
Message-ID: <20260113180409.36683-1-amishhhaaaa@gmail.com> (raw)

In t0100-previous.sh, the exit code of 'git cat-file' is suppressed by
piping it directly into grep. If git crashes, the test might not
notice.

Redirect the output of git to a temporary file 'actual' and grep
from that file instead. This ensures that the exit code of the
git command is properly checked.

Signed-off-by: amisha <amishhhaaaa@gmail.com>
---
 t/t0100-previous.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/t/t0100-previous.sh b/t/t0100-previous.sh
index dd5d9b4e5e..ffe3fda495 100755
--- a/t/t0100-previous.sh
+++ b/t/t0100-previous.sh
@@ -40,7 +40,8 @@ test_expect_success 'merge @{-1}' '
 	git checkout other &&
 	git checkout main &&
 	git merge @{-1} &&
-	git cat-file commit HEAD | grep "Merge branch '\''other'\''"
+	git cat-file commit HEAD >actual &&
+	grep "Merge branch '\''other'\''" actual
 '
 
 test_expect_success 'merge @{-1}~1' '
-- 
2.51.0


             reply	other threads:[~2026-01-13 18:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-13 18:04 amisha [this message]
2026-01-14 14:23 ` [PATCH] t0100: avoid suppressing git exit code Pushkar Singh

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=20260113180409.36683-1-amishhhaaaa@gmail.com \
    --to=amishhhaaaa@gmail.com \
    --cc=git@vger.kernel.org \
    /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