Thread (17 messages) flat view 17 messages, 4 authors, 2016-06-15
STALE3730d

Revision v5 of 2 in this series.

Revisions (2)
  1. v5 current
  2. v6 [diff vs current]

[PATCH v5 2/4] commit test: Use write_script

From: Caleb Thompson <hidden>
Date: 2016-06-15 23:01:36
Subsystem: the rest · Maintainer: Linus Torvalds

Use write_script from t/test-lib-functions.sh instead of cat, shebang,
and chmod. This protects us from potential shell meta-characters in the
name of our trash directory, which would be interpreted if we set
$EDITOR directly.

Signed-off-by: Caleb Thompson <redacted>
---
 t/t7507-commit-verbose.sh | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/t/t7507-commit-verbose.sh b/t/t7507-commit-verbose.sh
index 6d778ed..db09107 100755
--- a/t/t7507-commit-verbose.sh
+++ b/t/t7507-commit-verbose.sh
@@ -3,11 +3,9 @@
 test_description='verbose commit template'
 . ./test-lib.sh
 
-cat >check-for-diff <<EOF
-#!$SHELL_PATH
-exec grep '^diff --git' "\$1"
+write_script check-for-diff <<-'EOF'
+	exec grep '^diff --git' "$1"
 EOF
-chmod +x check-for-diff
 test_set_editor "$PWD/check-for-diff"
 
 cat >message <<'EOF'
-- 
2.0.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