git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Edwin Fernando <edwinfernando734@gmail.com>
To: git@vger.kernel.org
Cc: Edwin Fernando <edwinfernando734@gmail.com>,
	Eric Sunshine <sunshine@sunshineco.com>,
	Andrei Rybak <rybak.a.v@gmail.com>
Subject: [GSOC][PATCH v4] t3701: don't lose "git" exit codes in test scripts
Date: Sun,  2 Apr 2023 20:17:09 +0100	[thread overview]
Message-ID: <20230402191709.19296-1-edwinfernando734@gmail.com> (raw)
In-Reply-To: <20230402113607.2394-1-edwinfernando734@gmail.com>

Exit codes are lost due to piping: "git ... | <command>"
Fix these issues using the intermediate step of writing output to file.

Signed-off-by: Edwin Fernando <edwinfernando734@gmail.com>
---
Apply my changes on top of the latest commit in upstream history.
Test 76 in t3701 fails. This commit breaks the test:
a9f4a01760 (Merge branch 'jk/add-p-unmerged-fix', 2023-03-19)
Identified by checking out commits in:
"git log --oneline -- t/t3701-add-interactive.sh"
I don't know if it is normal to have broken tests in the main repository.

 t/t3701-add-interactive.sh | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh
index 3982b6b49d..b8291206a0 100755
--- a/t/t3701-add-interactive.sh
+++ b/t/t3701-add-interactive.sh
@@ -286,8 +286,10 @@ test_expect_success FILEMODE 'patch does not affect mode' '
 	echo content >>file &&
 	chmod +x file &&
 	printf "n\\ny\\n" | git add -p &&
-	git show :file | grep content &&
-	git diff file | grep "new mode"
+	git show :file >show &&
+	grep content show &&
+	git diff file >diff &&
+	grep "new mode" diff
 '
 
 test_expect_success FILEMODE 'stage mode but not hunk' '
@@ -295,8 +297,10 @@ test_expect_success FILEMODE 'stage mode but not hunk' '
 	echo content >>file &&
 	chmod +x file &&
 	printf "y\\nn\\n" | git add -p &&
-	git diff --cached file | grep "new mode" &&
-	git diff          file | grep "+content"
+	git diff --cached file >diff &&
+	grep "new mode" diff &&
+	git diff file >diff &&
+	grep "+content" diff
 '
 
 
-- 
2.40.0


  parent reply	other threads:[~2023-04-02 19:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-26 17:31 [GSOC][PATCH 0/1] Avoid suppression of git's exit code in tests Edwin Fernando
2023-03-26 17:31 ` [GSOC][PATCH 1/1] t3701: Avoid suppression of exit status of git Edwin Fernando
2023-03-26 20:14   ` Andrei Rybak
2023-03-27 10:11     ` Eric Sunshine
2023-04-01 19:47 ` [GSOC][PATCH v2] t3701: don't lose "git" exit codes in test scripts Edwin Fernando
2023-04-02 10:41   ` Andrei Rybak
2023-04-02 11:36   ` [GSOC][PATCH v3] " Edwin Fernando
2023-04-02 17:17     ` Eric Sunshine
2023-04-02 19:17     ` Edwin Fernando [this message]
2023-04-03  6:24       ` [GSOC][PATCH v4] " Eric Sunshine
2023-04-03  9:21         ` Edwin Fernando
2023-04-03  9:34         ` Edwin Fernando
2023-04-03 17:03           ` Eric Sunshine

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20230402191709.19296-1-edwinfernando734@gmail.com \
    --to=edwinfernando734@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=rybak.a.v@gmail.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).