Thread (17 messages) flat view 17 messages, 4 authors, 2020-08-13
STALE2212d

[PATCH v2 1/4] t7401: modernize style

From: Shourya Shukla <hidden>
Date: 2020-08-12 19:27:58
Subsystem: the rest · Maintainer: Linus Torvalds

The tests in 't7401-submodule-summary.sh' were written a long time ago
and has a violation with respect to our CodingGuidelines which is,
incorrect spacing in usages of the redirection operator.
Using a Git command in the upstream of a pipe might result in us
losing its exit code. So, convert such usages so that they write to
a file and read from them.

Mentored-by: Christian Couder [off-list ref]
Mentored-by: Kaartic Sivaraam [off-list ref]
Helped-by: Denton Liu [off-list ref]
Helped-by: Taylor Blau [off-list ref]
Signed-off-by: Shourya Shukla <redacted>
---
 t/t7401-submodule-summary.sh | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/t/t7401-submodule-summary.sh b/t/t7401-submodule-summary.sh
index 9bc841d085..8ee78bcb69 100755
--- a/t/t7401-submodule-summary.sh
+++ b/t/t7401-submodule-summary.sh
@@ -16,12 +16,13 @@ add_file () {
 	owd=$(pwd)
 	cd "$sm"
 	for name; do
-		echo "$name" > "$name" &&
+		echo "$name" >"$name" &&
 		git add "$name" &&
 		test_tick &&
 		git commit -m "Add $name"
 	done >/dev/null
-	git rev-parse --verify HEAD | cut -c1-7
+	git rev-parse --verify HEAD >out &&
+	cut -c1-7 out
 	cd "$owd"
 }
 commit_file () {
@@ -125,7 +126,8 @@ commit_file sm1 &&
 head3=$(
 	cd sm1 &&
 	git reset --hard HEAD~2 >/dev/null &&
-	git rev-parse --verify HEAD | cut -c1-7
+	git rev-parse --verify HEAD >out &&
+	cut -c1-7 out
 )
 
 test_expect_success 'modified submodule(backward)' "
-- 
2.28.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help