Thread (26 messages) flat view 26 messages, 7 authors, 2016-11-08

Re: [PATCH 2/4] t0021: put $TEST_ROOT in $PATH

From: Lars Schneider <hidden>
Date: 2016-11-06 14:30:52

quoted hunk ↗ jump to hunk
On 02 Nov 2016, at 19:18, Jeff King [off-list ref] wrote:

We create a rot13.sh script in the trash directory, but need
to call it by its full path when we have moved our cwd to
another directory. Let's just put $TEST_ROOT in our $PATH so
that the script is always found.

This is a minor convenience for rot13.sh, but will be a
major one when we switch rot13-filter.pl to a script in the
same directory, as it means we will not have to deal with
shell quoting inside the filter-process config.

Signed-off-by: Jeff King <redacted>
---
t/t0021-conversion.sh | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh
index dfde22549..c1ad20c61 100755
--- a/t/t0021-conversion.sh
+++ b/t/t0021-conversion.sh
@@ -5,6 +5,7 @@ test_description='blob conversion via gitattributes'
. ./test-lib.sh

TEST_ROOT="$(pwd)"
+PATH=$TEST_ROOT:$PATH

write_script <<\EOF "$TEST_ROOT/rot13.sh"
tr \
@@ -64,7 +65,7 @@ test_cmp_exclude_clean () {
# is equal to the committed content.
test_cmp_committed_rot13 () {
	test_cmp "$1" "$2" &&
-	"$TEST_ROOT/rot13.sh" <"$1" >expected &&
+	rot13.sh <"$1" >expected &&
	git cat-file blob :"$2" >actual &&
	test_cmp expected actual
}
@@ -513,7 +514,7 @@ test_expect_success PERL 'required process filter should process multiple packet
		for FILE in "$TEST_ROOT"/*.file
		do
			cp "$FILE" . &&
-			"$TEST_ROOT/rot13.sh" <"$FILE" >"$FILE.rot13"
+			rot13.sh <"$FILE" >"$FILE.rot13"
		done &&

		echo "*.file filter=protocol" >.gitattributes &&
@@ -616,7 +617,7 @@ test_expect_success PERL 'process filter should restart after unexpected write f
		# Smudge failed
		! test_cmp smudge-write-fail.o smudge-write-fail.r &&
-		"$TEST_ROOT/rot13.sh" <smudge-write-fail.o >expected &&
+		rot13.sh <smudge-write-fail.o >expected &&
		git cat-file blob :smudge-write-fail.r >actual &&
		test_cmp expected actual
	)
-- 
2.11.0.rc0.258.gf434c15
Looks good to me and the PWD Windows fix suggested by Hannes [1] works great
on macOS.

Thanks,
Lars

[1] http://public-inbox.org/git/20161103204438.zfe653c2bsv3zqkx@sigill.intra.peff.net/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help