git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Use an intermediate file between between git blame and sed to avoid git blame's exit code being hidden.

From
michael@platin.gs <michael@platin.gs>
Date
Jun 15, 2019, 18:40 UTC
Message-ID
<20190615184039.3711-1-michael@platin.gs>
From: Michael Platings <michael@platin.gs>
---
 t/t8014-blame-ignore-fuzzy.sh | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/t/t8014-blame-ignore-fuzzy.sh b/t/t8014-blame-ignore-fuzzy.sh
index 1ff59624e9..13f3313710 100755
--- a/t/t8014-blame-ignore-fuzzy.sh
+++ b/t/t8014-blame-ignore-fuzzy.sh
@@ -332,7 +332,9 @@ test_expect_success setup '
 for i in $(test_seq 2 $last_test); do
 	eval title="\$title$i"
 	test_expect_success "$title" \
-	"git blame -M9 --ignore-rev $IGNOREME $i | sed -e \"$pick_author\" >actual && test_cmp expected$i actual"
+	"git blame -M9 --ignore-rev $IGNOREME $i >output &&
+	sed -e \"$pick_author\" <output >actual &&
+	test_cmp expected$i actual"
 done
 
 # This invoked a null pointer dereference when the chunk callback was called
@@ -357,7 +359,8 @@ test_expect_success 'Diff chunks with no suspects' '
 
 	test_write_lines 1 1 >expected &&
 
-	git blame --ignore-rev $REV_2 --ignore-rev $REV_3 file | sed -e "$pick_author" >actual &&
+	git blame --ignore-rev $REV_2 --ignore-rev $REV_3 file >output &&
+	sed -e "$pick_author" <output >actual &&
 
 	test_cmp expected actual
 	'
@@ -387,7 +390,8 @@ test_expect_success 'position matching' '
 
 	test_write_lines 1 1 2 2 >expected &&
 
-	git blame --ignore-rev $REV_3 --ignore-rev $REV_4 file2 | sed -e "$pick_author" >actual &&
+	git blame --ignore-rev $REV_3 --ignore-rev $REV_4 file2 >output &&
+	sed -e "$pick_author" <output >actual &&
 
 	test_cmp expected actual
 	'
@@ -424,7 +428,8 @@ test_expect_success 'preserve order' '
 
 	test_write_lines 1 2 3 >expected &&
 
-	git blame --ignore-rev $REV_4 --ignore-rev $REV_5 file3 | sed -e "$pick_author" >actual &&
+	git blame --ignore-rev $REV_4 --ignore-rev $REV_5 file3 >output &&
+	sed -e "$pick_author" <output >actual &&
 
 	test_cmp expected actual
 	'
-- 
2.21.0
Next: Denton Liu
Message 1 of 4 in “Use an intermediate file between between git blame and sed to avoid git blame's exit code being hidden.”
  1. Use an intermediate file between between git blame and sed to avoid git blame's exit code being hidden.michael@platin.gs, Jun 15, 2019
  2. Denton LiuJun 16, 2019
  3. Michael PlatingsJun 16, 2019
  4. Junio C HamanoJun 16, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.