Commit 743f0d3e8ead71af69563ac2855766f4f1c4d7de

Stefan Sperling 2020-10-01T20:52:11

add quotes around $GOT_TEST_ROOT and avoid mktemp -p; suggested by naddy

diff --git a/regress/cmdline/Makefile b/regress/cmdline/Makefile
index 081593c..e32b5a1 100644
--- a/regress/cmdline/Makefile
+++ b/regress/cmdline/Makefile
@@ -6,78 +6,78 @@ NOOBJ=Yes
 GOT_TEST_ROOT=/tmp
 
 checkout:
-	./checkout.sh -q -r $(GOT_TEST_ROOT)
+	./checkout.sh -q -r "$(GOT_TEST_ROOT)"
 
 update:
-	./update.sh -q -r $(GOT_TEST_ROOT)
+	./update.sh -q -r "$(GOT_TEST_ROOT)"
 
 status:
-	./status.sh -q -r $(GOT_TEST_ROOT)
+	./status.sh -q -r "$(GOT_TEST_ROOT)"
 
 log:
-	./log.sh -q -r $(GOT_TEST_ROOT)
+	./log.sh -q -r "$(GOT_TEST_ROOT)"
 
 add:
-	./add.sh -q -r $(GOT_TEST_ROOT)
+	./add.sh -q -r "$(GOT_TEST_ROOT)"
 
 rm:
-	./rm.sh -q -r $(GOT_TEST_ROOT)
+	./rm.sh -q -r "$(GOT_TEST_ROOT)"
 
 diff:
-	./diff.sh -q -r $(GOT_TEST_ROOT)
+	./diff.sh -q -r "$(GOT_TEST_ROOT)"
 
 blame:
-	./blame.sh -q -r $(GOT_TEST_ROOT)
+	./blame.sh -q -r "$(GOT_TEST_ROOT)"
 
 branch:
-	./branch.sh -q -r $(GOT_TEST_ROOT)
+	./branch.sh -q -r "$(GOT_TEST_ROOT)"
 
 tag:
-	./tag.sh -q -r $(GOT_TEST_ROOT)
+	./tag.sh -q -r "$(GOT_TEST_ROOT)"
 
 ref:
-	./ref.sh -q -r $(GOT_TEST_ROOT)
+	./ref.sh -q -r "$(GOT_TEST_ROOT)"
 
 commit:
-	./commit.sh -q -r $(GOT_TEST_ROOT)
+	./commit.sh -q -r "$(GOT_TEST_ROOT)"
 
 revert:
-	./revert.sh -q -r $(GOT_TEST_ROOT)
+	./revert.sh -q -r "$(GOT_TEST_ROOT)"
 
 cherrypick:
-	./cherrypick.sh -q -r $(GOT_TEST_ROOT)
+	./cherrypick.sh -q -r "$(GOT_TEST_ROOT)"
 
 backout:
-	./backout.sh -q -r $(GOT_TEST_ROOT)
+	./backout.sh -q -r "$(GOT_TEST_ROOT)"
 
 rebase:
-	./rebase.sh -q -r $(GOT_TEST_ROOT)
+	./rebase.sh -q -r "$(GOT_TEST_ROOT)"
 
 import:
-	./import.sh -q -r $(GOT_TEST_ROOT)
+	./import.sh -q -r "$(GOT_TEST_ROOT)"
 
 histedit:
-	./histedit.sh -q -r $(GOT_TEST_ROOT)
+	./histedit.sh -q -r "$(GOT_TEST_ROOT)"
 
 integrate:
-	./integrate.sh -q -r $(GOT_TEST_ROOT)
+	./integrate.sh -q -r "$(GOT_TEST_ROOT)"
 
 stage:
-	./stage.sh -q -r $(GOT_TEST_ROOT)
+	./stage.sh -q -r "$(GOT_TEST_ROOT)"
 
 unstage:
-	./unstage.sh -q -r $(GOT_TEST_ROOT)
+	./unstage.sh -q -r "$(GOT_TEST_ROOT)"
 
 cat:
-	./cat.sh -q -r $(GOT_TEST_ROOT)
+	./cat.sh -q -r "$(GOT_TEST_ROOT)"
 
 clone:
-	./clone.sh -q -r $(GOT_TEST_ROOT)
+	./clone.sh -q -r "$(GOT_TEST_ROOT)"
 
 fetch:
-	./fetch.sh -q -r $(GOT_TEST_ROOT)
+	./fetch.sh -q -r "$(GOT_TEST_ROOT)"
 
 tree:
-	./tree.sh -q -r $(GOT_TEST_ROOT)
+	./tree.sh -q -r "$(GOT_TEST_ROOT)"
 
 .include <bsd.regress.mk>
diff --git a/regress/cmdline/common.sh b/regress/cmdline/common.sh
index d022c28..cde580f 100644
--- a/regress/cmdline/common.sh
+++ b/regress/cmdline/common.sh
@@ -169,7 +169,7 @@ test_init()
 		echo "No test name provided" >&2
 		return 1
 	fi
-	local testroot=`mktemp -p $GOT_TEST_ROOT -d got-test-$testname-XXXXXXXX`
+	local testroot=$(mktemp -d "$GOT_TEST_ROOT/got-test-$testname-XXXXXXXX")
 	mkdir $testroot/repo
 	git_init $testroot/repo
 	if [ -z "$no_tree" ]; then
diff --git a/regress/cmdline/import.sh b/regress/cmdline/import.sh
index 8678e99..5d5816f 100755
--- a/regress/cmdline/import.sh
+++ b/regress/cmdline/import.sh
@@ -18,7 +18,7 @@
 
 test_import_basic() {
 	local testname=import_basic
-	local testroot=`mktemp -p $GOT_TEST_ROOT -d got-test-$testname-XXXXXXXX`
+	local testroot=`mktemp -d "$GOT_TEST_ROOT/got-test-$testname-XXXXXXXX"`
 
 	got init $testroot/repo
 
@@ -170,7 +170,7 @@ test_import_requires_new_branch() {
 
 test_import_ignores() {
 	local testname=import_ignores
-	local testroot=`mktemp -p $GOT_TEST_ROOT -d got-test-$testname-XXXXXXXX`
+	local testroot=`mktemp -d "$GOT_TEST_ROOT/got-test-$testname-XXXXXXXX"`
 
 	got init $testroot/repo
 
@@ -200,7 +200,7 @@ test_import_ignores() {
 
 test_import_empty_dir() {
 	local testname=import_empty_dir
-	local testroot=`mktemp -p $GOT_TEST_ROOT -d got-test-$testname-XXXXXXXX`
+	local testroot=`mktemp -d "$GOT_TEST_ROOT/got-test-$testname-XXXXXXXX"`
 
 	got init $testroot/repo
 
@@ -243,7 +243,7 @@ test_import_empty_dir() {
 
 test_import_symlink() {
 	local testname=import_symlink
-	local testroot=`mktemp -p $GOT_TEST_ROOT -d got-test-$testname-XXXXXXXX`
+	local testroot=`mktemp -d "$GOT_TEST_ROOT/got-test-$testname-XXXXXXXX"`
 
 	got init $testroot/repo