Skip to contentSkip to conversation

Fixing path quoting issues

PATCH In review Jonathan del Strother 7 participants 38 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fixing path quoting issues

git-rebase and a number of tests didn't properly quote paths, leading to problems when run from a path with a space in.

---
 git-rebase.sh                            |   26 +++++-----
 t/t1020-subdirectory.sh                  |   22 ++++----
 t/t3050-subprojects-fetch.sh             |    2 +-
 t/t3404-rebase-interactive.sh            |    2 +-
 t/t5500-fetch-pack.sh                    |    2 +-
 t/t5700-clone-reference.sh               |    2 +-
 t/t7003-filter-branch.sh                 |    2 +-
 t/t7501-commit.sh                        |   74 +++++++++++++++---------------
 t/t9100-git-svn-basic.sh                 |   18 ++++----
 t/t9101-git-svn-props.sh                 |    6 +-
 t/t9102-git-svn-deep-rmdir.sh            |    6 +-
 t/t9104-git-svn-follow-parent.sh         |   50 ++++++++++----------
 t/t9105-git-svn-commit-diff.sh           |   10 ++--
 t/t9106-git-svn-commit-diff-clobber.sh   |   14 +++---
 t/t9107-git-svn-migrate.sh               |   40 ++++++++--------
 t/t9108-git-svn-glob.sh                  |    8 ++--
 t/t9110-git-svn-use-svm-props.sh         |    8 ++--
 t/t9111-git-svn-use-svnsync-props.sh     |    8 ++--
 t/t9112-git-svn-md5less-file.sh          |    4 +-
 t/t9113-git-svn-dcommit-new-file.sh      |    6 +-
 t/t9114-git-svn-dcommit-merge.sh         |    4 +-
 t/t9115-git-svn-dcommit-funky-renames.sh |    4 +-
 t/t9116-git-svn-log.sh                   |    4 +-
 t/test-lib.sh                            |    2 +-
 24 files changed, 162 insertions(+), 162 deletions(-)
git-rebase.sh +13 -13
index 1583402..b48397e 100755
@@ -59,7 +59,7 @@ continue_merge () {
 		die "$RESOLVEMSG"
 	fi
 
-	cmt=`cat $dotest/current`
+	cmt=`cat "$dotest/current"`
 	if ! git diff-index --quiet HEAD
 	then
 		if ! git-commit -C "$cmt"
@@ -84,14 +84,14 @@ continue_merge () {
 }
 
 call_merge () {
-	cmt="$(cat $dotest/cmt.$1)"
+	cmt="$(cat "$dotest/cmt.$1")"
 	echo "$cmt" > "$dotest/current"
 	hd=$(git rev-parse --verify HEAD)
 	cmt_name=$(git symbolic-ref HEAD)
-	msgnum=$(cat $dotest/msgnum)
-	end=$(cat $dotest/end)
+	msgnum=$(cat "$dotest/msgnum")
+	end=$(cat "$dotest/end")
 	eval GITHEAD_$cmt='"${cmt_name##refs/heads/}~$(($end - $msgnum))"'
-	eval GITHEAD_$hd='"$(cat $dotest/onto_name)"'
+	eval GITHEAD_$hd='"$(cat \"$dotest/onto_name\")"'
 	export GITHEAD_$cmt GITHEAD_$hd
 	git-merge-$strategy "$cmt^" -- "$hd" "$cmt"
 	rv=$?
@@ -140,10 +140,10 @@ do
 		}
 		if test -d "$dotest"
 		then
-			prev_head="`cat $dotest/prev_head`"
-			end="`cat $dotest/end`"
-			msgnum="`cat $dotest/msgnum`"
-			onto="`cat $dotest/onto`"
+			prev_head="`cat \"$dotest/prev_head\"`"
+			end="`cat \"$dotest/end\"`"
+			msgnum="`cat \"$dotest/msgnum\"`"
+			onto="`cat \"$dotest/onto\"`"
 			continue_merge
 			while test "$msgnum" -le "$end"
 			do
@@ -160,11 +160,11 @@ do
 		if test -d "$dotest"
 		then
 			git rerere clear
-			prev_head="`cat $dotest/prev_head`"
-			end="`cat $dotest/end`"
-			msgnum="`cat $dotest/msgnum`"
+			prev_head="`cat \"$dotest/prev_head\"`"
+			end="`cat \"$dotest/end\"`"
+			msgnum="`cat \"$dotest/msgnum\"`"
 			msgnum=$(($msgnum + 1))
-			onto="`cat $dotest/onto`"
+			onto="`cat \"$dotest/onto\"`"
 			while test "$msgnum" -le "$end"
 			do
 				call_merge "$msgnum"
t/t1020-subdirectory.sh +11 -11
index b9cef34..5ed7fa4 100755
@@ -21,7 +21,7 @@ LF='
 '
 
 test_expect_success 'update-index and ls-files' '
-	cd $HERE &&
+	cd "$HERE" &&
 	git update-index --add one &&
 	case "`git ls-files`" in
 	one) echo ok one ;;
@@ -41,7 +41,7 @@ test_expect_success 'update-index and ls-files' '
 '
 
 test_expect_success 'cat-file' '
-	cd $HERE &&
+	cd "$HERE" &&
 	two=`git ls-files -s dir/two` &&
 	two=`expr "$two" : "[0-7]* \\([0-9a-f]*\\)"` &&
 	echo "$two" &&
@@ -54,7 +54,7 @@ test_expect_success 'cat-file' '
 rm -f actual dir/actual
 
 test_expect_success 'diff-files' '
-	cd $HERE &&
+	cd "$HERE" &&
 	echo a >>one &&
 	echo d >>dir/two &&
 	case "`git diff-files --name-only`" in
@@ -74,7 +74,7 @@ test_expect_success 'diff-files' '
 '
 
 test_expect_success 'write-tree' '
-	cd $HERE &&
+	cd "$HERE" &&
 	top=`git write-tree` &&
 	echo $top &&
 	cd dir &&
@@ -84,7 +84,7 @@ test_expect_success 'write-tree' '
 '
 
 test_expect_success 'checkout-index' '
-	cd $HERE &&
+	cd "$HERE" &&
 	git checkout-index -f -u one &&
 	cmp one original.one &&
 	cd dir &&
@@ -93,7 +93,7 @@ test_expect_success 'checkout-index' '
 '
 
 test_expect_success 'read-tree' '
-	cd $HERE &&
+	cd "$HERE" &&
 	rm -f one dir/two &&
 	tree=`git write-tree` &&
 	git read-tree --reset -u "$tree" &&
@@ -107,27 +107,27 @@ test_expect_success 'read-tree' '
 '
 
 test_expect_success 'no file/rev ambiguity check inside .git' '
-	cd $HERE &&
+	cd "$HERE" &&
 	git commit -a -m 1 &&
-	cd $HERE/.git &&
+	cd "$HERE/.git" &&
 	git show -s HEAD
 '
 
 test_expect_success 'no file/rev ambiguity check inside a bare repo' '
-	cd $HERE &&
+	cd "$HERE" &&
 	git clone -s --bare .git foo.git &&
 	cd foo.git && GIT_DIR=. git show -s HEAD
 '
 
 # This still does not work as it should...
 : test_expect_success 'no file/rev ambiguity check inside a bare repo' '
-	cd $HERE &&
+	cd "$HERE" &&
 	git clone -s --bare .git foo.git &&
 	cd foo.git && git show -s HEAD
 '
 
 test_expect_success 'detection should not be fooled by a symlink' '
-	cd $HERE &&
+	cd "$HERE" &&
 	rm -fr foo.git &&
 	git clone -s .git another &&
 	ln -s another yetanother &&
t/t3050-subprojects-fetch.sh +1 -1
index 34f26a8..4b74cc6 100755
@@ -20,7 +20,7 @@ test_expect_success setup '
 '
 
 test_expect_success clone '
-	git clone file://`pwd`/.git cloned &&
+	git clone "file://`pwd`/.git" cloned &&
 	(git rev-parse HEAD; git ls-files -s) >expected &&
 	(
 		cd cloned &&
t/t3404-rebase-interactive.sh +1 -1
index 1113904..f321787 100755
@@ -92,7 +92,7 @@ done
 EOF
 
 chmod a+x fake-editor.sh
-VISUAL="$(pwd)/fake-editor.sh"
+VISUAL="'$(pwd)/fake-editor.sh'"
 export VISUAL
 
 test_expect_success 'no changes are a nop' '
t/t5500-fetch-pack.sh +1 -1
index 7b6798d..5489ffe 100755
@@ -129,7 +129,7 @@ pull_to_client 2nd "B" $((64*3))
 
 pull_to_client 3rd "A" $((1*3)) # old fails
 
-test_expect_success "clone shallow" "git-clone --depth 2 file://`pwd`/. shallow"
+test_expect_success "clone shallow" "git-clone --depth 2 \"file://`pwd`/.\" shallow"
 
 (cd shallow; git count-objects -v) > count.shallow
 
t/t5700-clone-reference.sh +1 -1
index 4e93aaa..8bb34f9 100755
@@ -51,7 +51,7 @@ diff expected current'
 cd "$base_dir"
 
 test_expect_success 'cloning with reference (no -l -s)' \
-'git clone --reference B file://`pwd`/A D'
+'git clone --reference B "file://`pwd`/A" D'
 
 cd "$base_dir"
 
t/t7003-filter-branch.sh +1 -1
index e935b20..1ab5392 100755
@@ -107,7 +107,7 @@ test_expect_success 'use index-filter to move into a subdirectory' '
 		 "git ls-files -s | sed \"s-\\t-&newsubdir/-\" |
 	          GIT_INDEX_FILE=\$GIT_INDEX_FILE.new \
 			git update-index --index-info &&
-		  mv \$GIT_INDEX_FILE.new \$GIT_INDEX_FILE" directorymoved &&
+		  mv \"\$GIT_INDEX_FILE.new\" \"\$GIT_INDEX_FILE\"" directorymoved &&
 	test -z "$(git diff HEAD directorymoved:newsubdir)"'
 
 test_expect_success 'stops when msg filter fails' '
t/t7501-commit.sh +37 -37

122 lines not on this page · raw message

t/t9100-git-svn-basic.sh +9 -9
index 614cf50..c3585da 100755
@@ -31,16 +31,16 @@ test_expect_success \
 	echo 'zzz' > bar/zzz &&
 	echo '#!/bin/sh' > exec.sh &&
 	chmod +x exec.sh &&
-	svn import -m 'import for git-svn' . $svnrepo >/dev/null &&
+	svn import -m 'import for git-svn' . '$svnrepo' >/dev/null &&
 	cd .. &&
 	rm -rf import &&
-	git-svn init $svnrepo"
+	git-svn init '$svnrepo'"
 
 test_expect_success \
     'import an SVN revision into git' \
     'git-svn fetch'
 
-test_expect_success "checkout from svn" "svn co $svnrepo '$SVN_TREE'"
+test_expect_success "checkout from svn" "svn co '$svnrepo' '$SVN_TREE'"
 
 name='try a deep --rmdir with a commit'
 test_expect_success "$name" "
@@ -169,7 +169,7 @@ test_expect_success "$name" "
 	svn up '$SVN_TREE' &&
 	test -f '$SVN_TREE'/exec-2.sh &&
 	test ! -L '$SVN_TREE'/exec-2.sh &&
-	git diff help $SVN_TREE/exec-2.sh"
+	git diff help '$SVN_TREE/exec-2.sh'"
 
 if test "$have_utf8" = t
 then
@@ -190,7 +190,7 @@ name='test fetch functionality (svn => git) with alternate GIT_SVN_ID'
 GIT_SVN_ID=alt
 export GIT_SVN_ID
 test_expect_success "$name" \
-    "git-svn init $svnrepo && git-svn fetch &&
+    "git-svn init '$svnrepo' && git-svn fetch &&
      git rev-list --pretty=raw remotes/git-svn | grep ^tree | uniq > a &&
      git rev-list --pretty=raw remotes/alt | grep ^tree | uniq > b &&
      git diff a b"
@@ -220,16 +220,16 @@ test_expect_failure 'exit if remote refs are ambigious' "
         "
 
 test_expect_failure 'exit if init-ing a would clobber a URL' "
-        svnadmin create ${PWD}/svnrepo2 &&
-        svn mkdir -m 'mkdir bar' ${svnrepo}2/bar &&
+        svnadmin create '${PWD}/svnrepo2' &&
+        svn mkdir -m 'mkdir bar' '${svnrepo}2/bar' &&
         git config --unset svn-remote.svn.fetch \
                                 '^bar:refs/remotes/git-svn$' &&
-        git-svn init ${svnrepo}2/bar
+        git-svn init '${svnrepo}2/bar'
         "
 
 test_expect_success \
   'init allows us to connect to another directory in the same repo' "
-        git-svn init --minimize-url -i bar $svnrepo/bar &&
+        git-svn init --minimize-url -i bar '$svnrepo/bar' &&
         git config --get svn-remote.svn.fetch \
                               '^bar:refs/remotes/bar$' &&
         git config --get svn-remote.svn.fetch \
t/t9101-git-svn-props.sh +3 -3
index 5aac644..a1c85e0 100755
@@ -52,7 +52,7 @@ EOF
 cd ..
 
 rm -rf import
-test_expect_success 'checkout working copy from svn' "svn co $svnrepo test_wc"
+test_expect_success 'checkout working copy from svn' "svn co '$svnrepo' test_wc"
 test_expect_success 'setup some commits to svn' \
 	'cd test_wc &&
 		echo Greetings >> kw.c &&
@@ -66,7 +66,7 @@ test_expect_success 'setup some commits to svn' \
 		svn commit -m "Propset Id" &&
 	cd ..'
 
-test_expect_success 'initialize git-svn' "git-svn init $svnrepo"
+test_expect_success 'initialize git-svn' "git-svn init '$svnrepo'"
 test_expect_success 'fetch revisions from svn' 'git-svn fetch'
 
 name='test svn:keywords ignoring'
@@ -92,7 +92,7 @@ test_expect_success "propset CR on crlf files" \
 test_expect_success 'fetch and pull latest from svn and checkout a new wc' \
 	"git-svn fetch &&
 	 git pull . remotes/git-svn &&
-	 svn co $svnrepo new_wc"
+	 svn co '$svnrepo' new_wc"
 
 for i in crlf ne_crlf lf ne_lf cr ne_cr empty_cr empty_lf empty empty_crlf
 do
t/t9102-git-svn-deep-rmdir.sh +3 -3
index 4e08083..99c8840 100755
@@ -9,12 +9,12 @@ test_expect_success 'initialize repo' "
 	mkdir -p deeply/nested/directory/number/2 &&
 	echo foo > deeply/nested/directory/number/1/file &&
 	echo foo > deeply/nested/directory/number/2/another &&
-	svn import -m 'import for git-svn' . $svnrepo &&
+	svn import -m 'import for git-svn' . '$svnrepo' &&
 	cd ..
 	"
 
 test_expect_success 'mirror via git-svn' "
-	git-svn init $svnrepo &&
+	git-svn init '$svnrepo' &&
 	git-svn fetch &&
 	git checkout -f -b test-rmdir remotes/git-svn
 	"
@@ -23,7 +23,7 @@ test_expect_success 'Try a commit on rmdir' "
 	git rm -f deeply/nested/directory/number/2/another &&
 	git commit -a -m 'remove another' &&
 	git-svn set-tree --rmdir HEAD &&
-	svn ls -R $svnrepo | grep ^deeply/nested/directory/number/1
+	svn ls -R '$svnrepo' | grep ^deeply/nested/directory/number/1
 	"
 
 
t/t9104-git-svn-follow-parent.sh +25 -25

130 lines not on this page · raw message

t/t9105-git-svn-commit-diff.sh +5 -5
index 318e172..2e1eb75 100755
@@ -8,7 +8,7 @@ test_expect_success 'initialize repo' "
 	mkdir import &&
 	cd import &&
 	echo hello > readme &&
-	svn import -m 'initial' . $svnrepo &&
+	svn import -m 'initial' . '$svnrepo' &&
 	cd .. &&
 	echo hello > readme &&
 	git update-index --add readme &&
@@ -27,16 +27,16 @@ prev=`git rev-parse --verify HEAD^1`
 test_expect_success 'test the commit-diff command' "
 	test -n '$prev' && test -n '$head' &&
 	git-svn commit-diff -r1 '$prev' '$head' '$svnrepo' &&
-	svn co $svnrepo wc &&
+	svn co '$svnrepo' wc &&
 	cmp readme wc/readme
 	"
 
 test_expect_success 'commit-diff to a sub-directory (with git-svn config)' "
-	svn import -m 'sub-directory' import $svnrepo/subdir &&
-	git-svn init --minimize-url $svnrepo/subdir &&
+	svn import -m 'sub-directory' import '$svnrepo/subdir' &&
+	git-svn init --minimize-url '$svnrepo/subdir' &&
 	git-svn fetch &&
 	git-svn commit-diff -r3 '$prev' '$head' &&
-	svn cat $svnrepo/subdir/readme > readme.2 &&
+	svn cat '$svnrepo/subdir/readme' > readme.2 &&
 	cmp readme readme.2
 	"
 
t/t9106-git-svn-commit-diff-clobber.sh +7 -7
index 79b7968..bb42339 100755
@@ -8,14 +8,14 @@ test_expect_success 'initialize repo' "
 	mkdir import &&
 	cd import &&
 	echo initial > file &&
-	svn import -m 'initial' . $svnrepo &&
+	svn import -m 'initial' . '$svnrepo' &&
 	cd .. &&
 	echo initial > file &&
 	git update-index --add file &&
 	git commit -a -m 'initial'
 	"
 test_expect_success 'commit change from svn side' "
-	svn co $svnrepo t.svn &&
+	svn co '$svnrepo' t.svn &&
 	cd t.svn &&
 	echo second line from svn >> file &&
 	poke file &&
@@ -27,7 +27,7 @@ test_expect_success 'commit change from svn side' "
 test_expect_failure 'commit conflicting change from git' "
 	echo second line from git >> file &&
 	git commit -a -m 'second line from git' &&
-	git-svn commit-diff -r1 HEAD~1 HEAD $svnrepo
+	git-svn commit-diff -r1 HEAD~1 HEAD '$svnrepo'
 	" || true
 
 test_expect_success 'commit complementing change from git' "
@@ -36,14 +36,14 @@ test_expect_success 'commit complementing change from git' "
 	git commit -a -m 'second line from svn' &&
 	echo third line from git >> file &&
 	git commit -a -m 'third line from git' &&
-	git-svn commit-diff -r2 HEAD~1 HEAD $svnrepo
+	git-svn commit-diff -r2 HEAD~1 HEAD '$svnrepo'
 	"
 
 test_expect_failure 'dcommit fails to commit because of conflict' "
-	git-svn init $svnrepo &&
+	git-svn init '$svnrepo' &&
 	git-svn fetch &&
 	git reset --hard refs/remotes/git-svn &&
-	svn co $svnrepo t.svn &&
+	svn co '$svnrepo' t.svn &&
 	cd t.svn &&
 	echo fourth line from svn >> file &&
 	poke file &&
@@ -67,7 +67,7 @@ test_expect_success 'dcommit does the svn equivalent of an index merge' "
 	"
 
 test_expect_success 'commit another change from svn side' "
-	svn co $svnrepo t.svn &&
+	svn co '$svnrepo' t.svn &&
 	cd t.svn &&
 		echo third line from svn >> file &&
 		poke file &&
t/t9107-git-svn-migrate.sh +20 -20
index 67fdf70..90bf786 100755
@@ -4,7 +4,7 @@ test_description='git-svn metadata migrations from previous versions'
 . ./lib-git-svn.sh
 
 test_expect_success 'setup old-looking metadata' "
-	cp $GIT_DIR/config $GIT_DIR/config-old-git-svn &&
+	cp '$GIT_DIR/config' '$GIT_DIR/config-old-git-svn' &&
 	mkdir import &&
 	cd import &&
 		for i in trunk branches/a branches/b \
@@ -12,13 +12,13 @@ test_expect_success 'setup old-looking metadata' "
 			mkdir -p \$i && \
 			echo hello >> \$i/README || exit 1
 		done && \
-		svn import -m test . $svnrepo
+		svn import -m test . '$svnrepo'
 		cd .. &&
-	git-svn init $svnrepo &&
+	git-svn init '$svnrepo' &&
 	git-svn fetch &&
-	mv $GIT_DIR/svn/* $GIT_DIR/ &&
-	mv $GIT_DIR/svn/.metadata $GIT_DIR/ &&
-	rmdir $GIT_DIR/svn &&
+	mv '$GIT_DIR'/svn/* '$GIT_DIR/' &&
+	mv '$GIT_DIR/svn/.metadata' '$GIT_DIR/' &&
+	rmdir '$GIT_DIR/svn' &&
 	git update-ref refs/heads/git-svn-HEAD refs/remotes/git-svn &&
 	git update-ref refs/heads/svn-HEAD refs/remotes/git-svn &&
 	git update-ref -d refs/remotes/git-svn refs/remotes/git-svn
@@ -28,20 +28,20 @@ head=`git rev-parse --verify refs/heads/git-svn-HEAD^0`
 test_expect_success 'git-svn-HEAD is a real HEAD' "test -n '$head'"
 
 test_expect_success 'initialize old-style (v0) git-svn layout' "
-	mkdir -p $GIT_DIR/git-svn/info $GIT_DIR/svn/info &&
-	echo $svnrepo > $GIT_DIR/git-svn/info/url &&
-	echo $svnrepo > $GIT_DIR/svn/info/url &&
+	mkdir -p '$GIT_DIR/git-svn/info' '$GIT_DIR/svn/info' &&
+	echo '$svnrepo' > '$GIT_DIR/git-svn/info/url' &&
+	echo '$svnrepo' > '$GIT_DIR/svn/info/url' &&
 	git-svn migrate &&
-	! test -d $GIT_DIR/git-svn &&
+	! test -d '$GIT_DIR/git-svn' &&
 	git rev-parse --verify refs/remotes/git-svn^0 &&
 	git rev-parse --verify refs/remotes/svn^0 &&
-	test \`git config --get svn-remote.svn.url\` = '$svnrepo' &&
+	test \"\`git config --get svn-remote.svn.url\`\" = \"$svnrepo\" &&
 	test \`git config --get svn-remote.svn.fetch\` = \
              ':refs/remotes/git-svn'
 	"
 
 test_expect_success 'initialize a multi-repository repo' "
-	git-svn init $svnrepo -T trunk -t tags -b branches &&
+	git-svn init '$svnrepo' -T trunk -t tags -b branches &&
 	git config --get-all svn-remote.svn.fetch > fetch.out &&
 	grep '^trunk:refs/remotes/trunk$' fetch.out &&
 	test -n \"\`git config --get svn-remote.svn.branches \
@@ -76,14 +76,14 @@ test_expect_success 'multi-fetch works on partial urls + paths' "
 test_expect_success 'migrate --minimize on old inited layout' "
 	git config --unset-all svn-remote.svn.fetch &&
 	git config --unset-all svn-remote.svn.url &&
-	rm -rf $GIT_DIR/svn &&
+	rm -rf '$GIT_DIR/svn' &&
 	for i in \`cat fetch.out\`; do
 		path=\`expr \$i : '\\([^:]*\\):.*$'\`
 		ref=\`expr \$i : '[^:]*:refs/remotes/\\(.*\\)$'\`
 		if test -z \"\$ref\"; then continue; fi
 		if test -n \"\$path\"; then path=\"/\$path\"; fi
-		( mkdir -p $GIT_DIR/svn/\$ref/info/ &&
-		echo $svnrepo\$path > $GIT_DIR/svn/\$ref/info/url ) || exit 1;
+		( mkdir -p '$GIT_DIR'/svn/\$ref/info/ &&
+		echo '$svnrepo'\$path > '$GIT_DIR'/svn/\$ref/info/url ) || exit 1;
 	done &&
 	git-svn migrate --minimize &&
 	test -z \"\`git config -l |grep -v '^svn-remote\.git-svn\.'\`\" &&
@@ -99,13 +99,13 @@ test_expect_success 'migrate --minimize on old inited layout' "
 
 test_expect_success  ".rev_db auto-converted to .rev_db.UUID" "
 	git-svn fetch -i trunk &&
-	expect=$GIT_DIR/svn/trunk/.rev_db.* &&
+	expect=\"\`find \"\$GIT_DIR\"/svn/trunk/ -name '.rev_db.*'\`\" &&
 	test -n \"\$expect\" &&
-	mv \$expect $GIT_DIR/svn/trunk/.rev_db &&
+	mv \"\$expect\" \"\$GIT_DIR\"/svn/trunk/.rev_db &&
 	git-svn fetch -i trunk &&
-	test -L $GIT_DIR/svn/trunk/.rev_db &&
-	test -f \$expect &&
-	cmp \$expect $GIT_DIR/svn/trunk/.rev_db
+	test -L \"\$GIT_DIR\"/svn/trunk/.rev_db &&
+	test -f \"\$expect\" &&
+	cmp \"\$expect\" \"\$GIT_DIR\"/svn/trunk/.rev_db
 	"
 
 test_done
t/t9108-git-svn-glob.sh +4 -4
index db4344c..c6dc0ef 100755
@@ -14,8 +14,8 @@ test_expect_success 'test refspec globbing' "
 	mkdir -p trunk/src/a trunk/src/b trunk/doc &&
 	echo 'hello world' > trunk/src/a/readme &&
 	echo 'goodbye world' > trunk/src/b/readme &&
-	svn import -m 'initial' trunk $svnrepo/trunk &&
-	svn co $svnrepo tmp &&
+	svn import -m 'initial' trunk '$svnrepo/trunk' &&
+	svn co '$svnrepo' tmp &&
 	cd tmp &&
 		mkdir branches tags &&
 		svn add branches tags &&
@@ -38,7 +38,7 @@ test_expect_success 'test refspec globbing' "
 		poke tags/end/src/b/readme &&
 		svn commit -m 'nothing to see here'
 		cd .. &&
-	git config --add svn-remote.svn.url $svnrepo &&
+	git config --add svn-remote.svn.url '$svnrepo' &&
 	git config --add svn-remote.svn.fetch \
 	                 'trunk/src/a:refs/remotes/trunk' &&
 	git config --add svn-remote.svn.branches \
@@ -60,7 +60,7 @@ echo nothing to see here >> expect.two
 cat expect.end >> expect.two
 
 test_expect_success 'test left-hand-side only globbing' "
-	git config --add svn-remote.two.url $svnrepo &&
+	git config --add svn-remote.two.url '$svnrepo' &&
 	git config --add svn-remote.two.fetch trunk:refs/remotes/two/trunk &&
 	git config --add svn-remote.two.branches \
 	                 'branches/*:refs/remotes/two/branches/*' &&
t/t9110-git-svn-use-svm-props.sh +4 -4
index 6235af4..d4ab01f 100755
@@ -8,11 +8,11 @@ test_description='git-svn useSvmProps test'
 . ./lib-git-svn.sh
 
 test_expect_success 'load svm repo' "
-	svnadmin load -q $rawsvnrepo < ../t9110/svm.dump &&
-	git-svn init --minimize-url -R arr -i bar $svnrepo/mirror/arr &&
-	git-svn init --minimize-url -R argh -i dir $svnrepo/mirror/argh &&
+	svnadmin load -q '$rawsvnrepo' < ../t9110/svm.dump &&
+	git-svn init --minimize-url -R arr -i bar '$svnrepo/mirror/arr' &&
+	git-svn init --minimize-url -R argh -i dir '$svnrepo/mirror/argh' &&
 	git-svn init --minimize-url -R argh -i e \
-	  $svnrepo/mirror/argh/a/b/c/d/e &&
+	  '$svnrepo/mirror/argh/a/b/c/d/e' &&
 	git config svn.useSvmProps true &&
 	git-svn fetch --all
 	"
t/t9111-git-svn-use-svnsync-props.sh +4 -4
index ec7dedd..936f023 100755
@@ -8,10 +8,10 @@ test_description='git-svn useSvnsyncProps test'
 . ./lib-git-svn.sh
 
 test_expect_success 'load svnsync repo' "
-	svnadmin load -q $rawsvnrepo < ../t9111/svnsync.dump &&
-	git-svn init --minimize-url -R arr -i bar $svnrepo/bar &&
-	git-svn init --minimize-url -R argh -i dir $svnrepo/dir &&
-	git-svn init --minimize-url -R argh -i e $svnrepo/dir/a/b/c/d/e &&
+	svnadmin load -q '$rawsvnrepo' < ../t9111/svnsync.dump &&
+	git-svn init --minimize-url -R arr -i bar '$svnrepo/bar' &&
+	git-svn init --minimize-url -R argh -i dir '$svnrepo/dir' &&
+	git-svn init --minimize-url -R argh -i e '$svnrepo/dir/a/b/c/d/e' &&
 	git config svn.useSvnsyncProps true &&
 	git-svn fetch --all
 	"
t/t9112-git-svn-md5less-file.sh +2 -2
index 08313bb..b095583 100755
@@ -38,8 +38,8 @@ PROPS-END
 
 EOF
 
-test_expect_success 'load svn dumpfile' "svnadmin load $rawsvnrepo < dumpfile.svn"
+test_expect_success 'load svn dumpfile' "svnadmin load '$rawsvnrepo' < dumpfile.svn"
 
-test_expect_success 'initialize git-svn' "git-svn init $svnrepo"
+test_expect_success 'initialize git-svn' "git-svn init '$svnrepo'"
 test_expect_success 'fetch revisions from svn' 'git-svn fetch'
 test_done
t/t9113-git-svn-dcommit-new-file.sh +3 -3
index 9ef0db9..0088c75 100755
@@ -15,14 +15,14 @@ test_description='git-svn dcommit new files over svn:// test'
 
 start_svnserve () {
 	svnserve --listen-port $SVNSERVE_PORT \
-	         --root $rawsvnrepo \
+	         --root '$rawsvnrepo' \
 	         --listen-once \
 	         --listen-host 127.0.0.1 &
 }
 
 test_expect_success 'start tracking an empty repo' "
-	svn mkdir -m 'empty dir' $svnrepo/empty-dir &&
-	echo anon-access = write >> $rawsvnrepo/conf/svnserve.conf &&
+	svn mkdir -m 'empty dir' '$svnrepo/empty-dir' &&
+	echo anon-access = write >> '$rawsvnrepo/conf/svnserve.conf' &&
 	start_svnserve &&
 	git svn init svn://127.0.0.1:$SVNSERVE_PORT &&
 	git svn fetch
t/t9114-git-svn-dcommit-merge.sh +2 -2
index d6ca955..64ec7fd 100755
@@ -35,7 +35,7 @@ EOF
 }
 
 test_expect_success 'setup svn repository' "
-	svn co $svnrepo mysvnwork &&
+	svn co '$svnrepo' mysvnwork &&
 	mkdir -p mysvnwork/trunk &&
 	cd mysvnwork &&
 		big_text_block >> trunk/README &&
@@ -45,7 +45,7 @@ test_expect_success 'setup svn repository' "
 	"
 
 test_expect_success 'setup git mirror and merge' "
-	git svn init $svnrepo -t tags -T trunk -b branches &&
+	git svn init '$svnrepo' -t tags -T trunk -b branches &&
 	git svn fetch &&
 	git checkout --track -b svn remotes/trunk &&
 	git checkout -b merge &&
t/t9115-git-svn-dcommit-funky-renames.sh +2 -2
index 182299c..653578d 100755
@@ -8,12 +8,12 @@ test_description='git-svn dcommit can commit renames of files with ugly names'
 . ./lib-git-svn.sh
 
 test_expect_success 'load repository with strange names' "
-	svnadmin load -q $rawsvnrepo < ../t9115/funky-names.dump &&
+	svnadmin load -q '$rawsvnrepo' < ../t9115/funky-names.dump &&
 	start_httpd
 	"
 
 test_expect_success 'init and fetch repository' "
-	git svn init $svnrepo &&
+	git svn init '$svnrepo' &&
 	git svn fetch &&
 	git reset --hard git-svn
 	"
t/t9116-git-svn-log.sh +2 -2
index 0d4e6b3..70c0c5f 100755
@@ -14,9 +14,9 @@ test_expect_success 'setup repository and import' "
 			mkdir -p \$i && \
 			echo hello >> \$i/README || exit 1
 		done && \
-		svn import -m test . $svnrepo
+		svn import -m test . '$svnrepo'
 		cd .. &&
-	git-svn init $svnrepo -T trunk -b branches -t tags &&
+	git-svn init '$svnrepo' -T trunk -b branches -t tags &&
 	git-svn fetch &&
 	git reset --hard trunk &&
 	echo bye >> README &&
t/test-lib.sh +1 -1
index cc1253c..a68415f 100644
@@ -229,7 +229,7 @@ test_create_repo () {
 	repo="$1"
 	mkdir "$repo"
 	cd "$repo" || error "Cannot setup test environment"
-	"$GIT_EXEC_PATH/git" init --template=$GIT_EXEC_PATH/templates/blt/ >/dev/null 2>&1 ||
+	"$GIT_EXEC_PATH/git" init --template="$GIT_EXEC_PATH/templates/blt/" >/dev/null 2>&1 ||
 	error "cannot run git init -- have you built things yet?"
 	mv .git/hooks .git/hooks-disabled
 	cd "$owd"
Signature · 1 line
1.5.3.1
#1 lore raw

git-rebase.sh continue_merge () { · line 62

Quoted 1 line · Jonathan del Strother
git-rebase.sh +1 -0
+	cmt=`cat "$dotest/current"`

This is ok, but...

Review

Quoted 1 line
(quoted diff) +1 -0
+			prev_head="`cat \"$dotest/prev_head\"`"

... there are shells out there in the wild that will get badly confused by this sort of quoting and escaping. Butter use

	prev_head=$(cat "$dotest/prev_head")

t/t3404-rebase-interactive.sh done · line 95

Quoted 2 lines
t/t3404-rebase-interactive.sh +1 -1
-VISUAL="$(pwd)/fake-editor.sh"
+VISUAL="'$(pwd)/fake-editor.sh'"

Huh? This looks very wrong. What are the extra quotes needed for? If they are really needed, isn't this a bug in git-rebase--interactive.sh?

t/t7501-commit.sh test_expect_success \ · line 83

Quoted 2 lines
t/t7501-commit.sh +1 -1
-	 git-commit -F msg -m amending ."
+	git-commit -F msg -m amending ."

You fix whitespace...

t/t7501-commit.sh test_expect_success \ · line 87

Quoted 5 lines

test_expect_success \

t/t7501-commit.sh +2 -2
-	"using message from other commit" \
-	"git-commit -C HEAD^ ."
+	 "using message from other commit" \
+	 "git-commit -C HEAD^ ."

... and you break it. More of these follow. Don't do that, it makes patch review unnecessarily hard.

I question the usefulness of this patch. Why only fix breakage due to spaces in the path? What about single-quotes, double-quotes? IMHO, it's not too much of a burden for developers to require "sane" build directory paths.

-- Hannes

#2 lore raw
Quoted 10 lines · Johannes Sixt

git-rebase.sh continue_merge () { · line 62

Quoted 1 line · Jonathan del Strother
git-rebase.sh +1 -0
+	cmt=`cat "$dotest/current"`

This is ok, but...

Review

Quoted 1 line
(quoted diff) +1 -0
+			prev_head="`cat \"$dotest/prev_head\"`"

... there are shells out there in the wild that will get badly confused by this sort of quoting and escaping. Butter use

Quoted 7 lines
	prev_head=$(cat "$dotest/prev_head")

t/t3404-rebase-interactive.sh done · line 95

Quoted 2 lines
t/t3404-rebase-interactive.sh +1 -1
-VISUAL="$(pwd)/fake-editor.sh"
+VISUAL="'$(pwd)/fake-editor.sh'"

Huh? This looks very wrong.

It is correct, modulo breaking when there are single quotes in the current path name.

Quoted 1 line

What are the extra quotes needed for?

Spaces in the current path name.

Quoted 2 lines

If they are really needed, isn't this a bug in
git-rebase--interactive.sh?

No.

Quoted 2 lines

I question the usefulness of this patch. Why only fix breakage due to spaces in the path? What about single-quotes, double-quotes?

Double quotes would work. Single quotes wouldn't. You can do something like

visualpath="$(pwd)"
export visualpath
VISUAL='"$visualpath/fake-editor.sh"'

and this should work in all circumstances where VISUAL is interpreted as intended (which at the current point of time does not include git's C callers).

Quoted 2 lines

IMHO, it's not too much of a burden for developers to require "sane" build directory paths.

For a normal user, the only writable directories might be of the "C:\Programs and Data\User settings\Karl"
variety.

Signature · 1 line
David Kastrup, Kriemhildstr. 15, 44793 Bochum
#3 lore raw
Quoted 7 lines · David Kastrup
Quoted 2 lines · Johannes Sixt

IMHO, it's not too much of a burden for developers to require "sane" build directory paths.

For a normal user, the only writable directories might be of the "C:\Programs and Data\User settings\Karl"
variety.

I whole-heartedly agree about the part of the patch that fixes git-rebase.sh. This should be a separate patch.

But the reset of the patch is about running the test suite, and it is much more difficult to fix because of the 'eval' that is going on. And, yes, I do think that we can expect that contributors, including this handful of people on Windows, have a "sane" build directory.

-- Hannes

#4 lore raw
Quoted 11 lines · Johannes Sixt
Quoted 6 lines · David Kastrup
Quoted 2 lines · Johannes Sixt

IMHO, it's not too much of a burden for developers to require "sane" build directory paths.

For a normal user, the only writable directories might be of the "C:\Programs and Data\User settings\Karl"
variety.

I whole-heartedly agree about the part of the patch that fixes git-rebase.sh. This should be a separate patch.

But the reset of the patch is about running the test suite, and it is much more difficult to fix because of the 'eval' that is going on. And, yes, I do think that we can expect that contributors, including this handful of people on Windows, have a "sane" build directory.

How are you going to test that git works on paths with spaces if the test suite doesn't run there?

#5 lore raw
Quoted 1 line · Jonathan del Strother

How are you going to test that git works on paths with spaces if the test suite doesn't run there?

By writing a specific test?

-- Hannes

#6 lore raw
Quoted 5 lines · Johannes Sixt
Quoted 2 lines · Jonathan del Strother

How are you going to test that git works on paths with spaces if the test suite doesn't run there?

By writing a specific test?

This is going to be much less thorough. And it does no harm if the test scripts demonstrate defensive programming.

Signature · 1 line
David Kastrup, Kriemhildstr. 15, 44793 Bochum
#7 lore raw
Quoted 10 lines · David Kastrup
Quoted 5 lines · Johannes Sixt
Quoted 2 lines · Jonathan del Strother

How are you going to test that git works on paths with spaces if the test suite doesn't run there?

By writing a specific test?

This is going to be much less thorough. And it does no harm if the test scripts demonstrate defensive programming.

I would also point out that most tests have already been written to handle this case - ones that don't quote their paths are in the minority.

#8 lore raw
Quoted 9 lines · Jonathan del Strother
Quoted 6 lines · David Kastrup
Quoted 4 lines · Johannes Sixt
Quoted 2 lines · Jonathan del Strother

How are you going to test that git works on paths with spaces if the test suite doesn't run there?

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

By writing a specific test?

This is going to be much less thorough. And it does no harm if the test scripts demonstrate defensive programming.

I would also point out that most tests have already been written to handle this case - ones that don't quote their paths are in the minority.

Actually, reconsidering your proposed patch, there are only a handful of problematic cases, namely those where the test script is quoted with double-quotes, like this:

test_expect_success 'load repository with strange names' "
- svnadmin load -q $rawsvnrepo < ../t9115/funky-names.dump &&
+ svnadmin load -q '$rawsvnrepo' < ../t9115/funky-names.dump &&
start_httpd
"

The problem is that here $rawsvnrepo will be expanded before the entire test script is passed as argument to test_expect_success. Consider the case where $rawsvnrepo contains a single-quote (say, a directory named "Joe's git"): then the 'eval' inside test_expect_success sees a syntax error. The proper change is:

test_expect_success 'load repository with strange names' "
- svnadmin load -q $rawsvnrepo < ../t9115/funky-names.dump &&
+ svnadmin load -q \"\$rawsvnrepo\" < ../t9115/funky-names.dump &&
start_httpd
"

So, what I think you should do is:

1. Submit the change to git-rebase.sh in a separate patch.
2. Fix the patch for the double-quoted test scriptlets.

That should remove all my concerns.

-- Hannes

#9 lore raw
In reply to Jonathan del Strother

Hi,

Quoted 4 lines · Jonathan del Strother
Quoted 2 lines · David Kastrup

Johannes Sixt <[email protected]> writes:

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines · Jonathan del Strother

How are you going to test that git works on paths with spaces if the test suite doesn't run there?

By writing a specific test?

This is going to be much less thorough. And it does no harm if the test scripts demonstrate defensive programming.

We do not have _extensive_ tests. We want to do some coding in addition to waiting for our machines to finish the test. D'oh.

Quoted 3 lines

I would also point out that most tests have already been written to handle this case - ones that don't quote their paths are in the minority.

That might very well be the case, and your goal is laudable. However, I have to agree that most devs (indeed, since you are the first to try to fix it, _all_ except for you) do not care that deeply about spaces in the path, and having a _single_ test for this would be the logical solution.

I mean, we do not force our main developers to run the most obscure setups all the time just to make sure that it runs fine. Otherwise none of us could run Linux, but a couple would be coerced into running Windows, for example.

Ciao,
Dscho

#10 lore raw
Quoted 10 lines · Johannes Schindelin
Quoted 8 lines · Jonathan del Strother
Quoted 6 lines · David Kastrup
Quoted 4 lines · Johannes Sixt
Quoted 2 lines · Jonathan del Strother

How are you going to test that git works on paths with spaces if the test suite doesn't run there?

Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line

By writing a specific test?

This is going to be much less thorough. And it does no harm if the test scripts demonstrate defensive programming.

We do not have _extensive_ tests. We want to do some coding in addition to waiting for our machines to finish the test. D'oh.

A good reason for not requiring special tests just for spaces.

Signature · 1 line
David Kastrup, Kriemhildstr. 15, 44793 Bochum
#11 lore raw
In reply to David Kastrup
Quoted 10 lines · David Kastrup
Quoted 5 lines · Johannes Sixt
Quoted 2 lines · Jonathan del Strother

How are you going to test that git works on paths with spaces if the test suite doesn't run there?

By writing a specific test?

This is going to be much less thorough. And it does no harm if the test scripts demonstrate defensive programming.

+1: especially in this case, where it really is "defensive" and not "paranoiac".

Cheers,
Wincent

#12 lore raw

Hi,

Quoted 8 lines · Wincent Colaiuta

El 11/10/2007, a las 22:53, David Kastrup escribi?:

Quoted 6 lines
Quoted 4 lines · Johannes Sixt
Quoted 2 lines · Jonathan del Strother

How are you going to test that git works on paths with spaces if the test suite doesn't run there?

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

By writing a specific test?

This is going to be much less thorough. And it does no harm if the test scripts demonstrate defensive programming.

+1: especially in this case, where it really is "defensive" and not "paranoiac".

I am all for it, _iff_ the guilty parties (and by that, I mean _you_) do it and keep maintaining it. See? Discussion closed already.

Ciao,
Dscho

#13 lore raw
Quoted 16 lines · Johannes Schindelin
Quoted 14 lines · Wincent Colaiuta
Quoted 11 lines · David Kastrup
Quoted 6 lines · Johannes Sixt
Quoted 3 lines · Jonathan del Strother

How are you going to test that git works on paths with spaces if the
test suite doesn't run there?

By writing a specific test?

This is going to be much less thorough. And it does no harm if the test scripts demonstrate defensive programming.

Quoted 6 lines
Quoted 2 lines

+1: especially in this case, where it really is "defensive" and not "paranoiac".

I am all for it, _iff_ the guilty parties (and by that, I mean _you_) do
it and keep maintaining it. See? Discussion closed already.

How am *I* the guilty party? I'm merely endorsing David's comment that a modicum of defensive programming isn't a bad thing; an eminently reasonable position which is somewhat difficult to argue against.

Cheers,
Wincent

#14 lore raw

Hi,

Quoted 21 lines · Wincent Colaiuta

El 12/10/2007, a las 13:37, Johannes Schindelin escribi?:

Quoted 19 lines · Wincent Colaiuta
Quoted 17 lines

El 11/10/2007, a las 22:53, David Kastrup escribi?:

Quoted 11 lines
Quoted 6 lines · Johannes Sixt
Quoted 3 lines · Jonathan del Strother

How are you going to test that git works on paths with spaces if the
test suite doesn't run there?

By writing a specific test?

This is going to be much less thorough. And it does no harm if the test scripts demonstrate defensive programming.

+1: especially in this case, where it really is "defensive" and not "paranoiac".

Quoted 6 lines
Quoted 2 lines

I am all for it, _iff_ the guilty parties (and by that, I mean _you_) do it and keep maintaining it. See? Discussion closed already.

How am *I* the guilty party? I'm merely endorsing David's comment that a modicum of defensive programming isn't a bad thing; an eminently reasonable position which is somewhat difficult to argue against.

All I'm saying: let patches speak. Talk is cheap.

Ciao,
Dscho

#15 lore raw
Quoted 23 lines · Johannes Schindelin
Quoted 21 lines · Wincent Colaiuta

El 12/10/2007, a las 13:37, Johannes Schindelin escribi?:

Quoted 19 lines · Wincent Colaiuta
Quoted 17 lines

El 11/10/2007, a las 22:53, David Kastrup escribi?:

Quoted 11 lines
Quoted 6 lines · Johannes Sixt
Quoted 3 lines · Jonathan del Strother

How are you going to test that git works on paths with spaces if the
test suite doesn't run there?

By writing a specific test?

This is going to be much less thorough. And it does no harm if the test scripts demonstrate defensive programming.

+1: especially in this case, where it really is "defensive" and not "paranoiac".

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

I am all for it, _iff_ the guilty parties (and by that, I mean _you_) do it and keep maintaining it. See? Discussion closed already.

How am *I* the guilty party? I'm merely endorsing David's comment that a modicum of defensive programming isn't a bad thing; an eminently reasonable position which is somewhat difficult to argue against.

All I'm saying: let patches speak. Talk is cheap.

The patches spoke. That is what the [PATCH] in the subject line was about.

Signature · 1 line
David Kastrup
#16 lore raw
In reply to Johannes Sixt
Quoted 5 lines · Johannes Sixt

t/t7501-commit.sh test_expect_success \ · line 83

Quoted 2 lines
t/t7501-commit.sh +1 -1
-	 git-commit -F msg -m amending ."
+	git-commit -F msg -m amending ."

You fix whitespace...

Quoted 7 lines

t/t7501-commit.sh test_expect_success \ · line 87

Quoted 5 lines

test_expect_success \

t/t7501-commit.sh +2 -2
-	"using message from other commit" \
-	"git-commit -C HEAD^ ."
+	 "using message from other commit" \
+	 "git-commit -C HEAD^ ."

... and you break it. More of these follow. Don't do that, it makes patch review unnecessarily hard.

I'm just preparing to release this patch... was that "don't break whitespace", or "don't try to fix whitespace in a patch that's has nothing to do with whitespacing-fixing" ?

And while I'm here - tabs are preferred, are they? There seem to be a mixture of tabs & 4 space indentation.

#17 lore raw
Quoted 13 lines · Jonathan del Strother
Quoted 11 lines · Johannes Sixt

t/t7501-commit.sh test_expect_success \ · line 83

Quoted 2 lines
t/t7501-commit.sh +1 -1
-     git-commit -F msg -m amending ."
+    git-commit -F msg -m amending ."

You fix whitespace...

Quoted 5 lines

test_expect_success \

t/t7501-commit.sh +2 -2
-    "using message from other commit" \
-    "git-commit -C HEAD^ ."
+     "using message from other commit" \
+     "git-commit -C HEAD^ ."
Quoted 5 lines
Quoted 1 line

... and you break it. More of these follow. Don't do that, it makes patch review unnecessarily hard.

I'm just preparing to release this patch... was that "don't break whitespace", or "don't try to fix whitespace in a patch that's has nothing to do with whitespacing-fixing" ?

Both, I think ;-)

Quoted 1 line

And while I'm here - tabs are preferred, are they? There seem to be a mixture of tabs & 4 space indentation.

1 hard tab / level of indent, but use spaces for continuation alignment.

Signature · 3 lines
Andreas Ericsson                   [email protected]
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
#18 lore raw

PATCH 1/3 Fixing path quoting in git-rebase

From: Jonathan del Strother <[email protected]>

git-rebase used to fail when run from a path with a space in.

---
 git-rebase.sh |   26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)
git-rebase.sh +13 -13
index 1583402..9995d9d 100755
@@ -59,7 +59,7 @@ continue_merge () {
 		die "$RESOLVEMSG"
 	fi
 
-	cmt=`cat $dotest/current`
+	cmt=`cat "$dotest/current"`
 	if ! git diff-index --quiet HEAD
 	then
 		if ! git-commit -C "$cmt"
@@ -84,14 +84,14 @@ continue_merge () {
 }
 
 call_merge () {
-	cmt="$(cat $dotest/cmt.$1)"
+	cmt="$(cat "$dotest/cmt.$1")"
 	echo "$cmt" > "$dotest/current"
 	hd=$(git rev-parse --verify HEAD)
 	cmt_name=$(git symbolic-ref HEAD)
-	msgnum=$(cat $dotest/msgnum)
-	end=$(cat $dotest/end)
+	msgnum=$(cat "$dotest/msgnum")
+	end=$(cat "$dotest/end")
 	eval GITHEAD_$cmt='"${cmt_name##refs/heads/}~$(($end - $msgnum))"'
-	eval GITHEAD_$hd='"$(cat $dotest/onto_name)"'
+	eval GITHEAD_$hd='"$(cat \"$dotest/onto_name\")"'
 	export GITHEAD_$cmt GITHEAD_$hd
 	git-merge-$strategy "$cmt^" -- "$hd" "$cmt"
 	rv=$?
@@ -140,10 +140,10 @@ do
 		}
 		if test -d "$dotest"
 		then
-			prev_head="`cat $dotest/prev_head`"
-			end="`cat $dotest/end`"
-			msgnum="`cat $dotest/msgnum`"
-			onto="`cat $dotest/onto`"
+			prev_head=$(cat "$dotest/prev_head")
+			end=$(cat "$dotest/end")
+			msgnum=$(cat "$dotest/msgnum")
+			onto=$(cat "$dotest/onto")
 			continue_merge
 			while test "$msgnum" -le "$end"
 			do
@@ -160,11 +160,11 @@ do
 		if test -d "$dotest"
 		then
 			git rerere clear
-			prev_head="`cat $dotest/prev_head`"
-			end="`cat $dotest/end`"
-			msgnum="`cat $dotest/msgnum`"
+			prev_head=$(cat "$dotest/prev_head")
+			end=$(cat "$dotest/end")
+			msgnum=$(cat "$dotest/msgnum")
 			msgnum=$(($msgnum + 1))
-			onto="`cat $dotest/onto`"
+			onto=$(cat "$dotest/onto")
 			while test "$msgnum" -le "$end"
 			do
 				call_merge "$msgnum"
Signature · 1 line
1.5.3.1
#19 lore raw

Re: [PATCH 1/3] Fixing path quoting in git-rebase

git-rebase.sh continue_merge () { · line 94

Quoted 2 lines · Jonathan del Strother
git-rebase.sh +1 -1
-	eval GITHEAD_$hd='"$(cat $dotest/onto_name)"'
+	eval GITHEAD_$hd='"$(cat \"$dotest/onto_name\")"'

I believe this is not correct. It should be this way:

	eval GITHEAD_$hd='$(cat "$dotest/onto_name")'

You can test it with a conflicting git-rebase -m. It only affects what the conflict markers look like. The test suite does not test it.

The rest looks good.

-- Hannes

#20 lore raw

Re: [PATCH 1/3] Fixing path quoting in git-rebase

Quoted 9 lines · Johannes Sixt

git-rebase.sh continue_merge () { · line 94

Quoted 2 lines · Jonathan del Strother
git-rebase.sh +1 -1
-	eval GITHEAD_$hd='"$(cat $dotest/onto_name)"'
+	eval GITHEAD_$hd='"$(cat \"$dotest/onto_name\")"'

I believe this is not correct. It should be this way:

	eval GITHEAD_$hd='$(cat "$dotest/onto_name")'

You can test it with a conflicting git-rebase -m. It only affects what the conflict markers look like. The test suite does not test it.

Thanks for catching that. I'll post revised patches this morning

#21 lore raw

PATCH 1/1 Quoting paths, take 3

These patches attempt to fix things up for people who like to have awkward directory paths including spaces & apostrophes. First patch fixes git-rebase (all other git tools handle these paths fine), second patch fixes up the tests so they can be run from spaced directories. Third time lucky?

#22 lore raw

PATCH 1/2 Fixing path quoting in git-rebase

From: Jonathan del Strother <[email protected]>

git-rebase used to fail when run from a path with a space in.

---
 git-rebase.sh |   26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)
git-rebase.sh +13 -13
index 1583402..224cca9 100755
@@ -59,7 +59,7 @@ continue_merge () {
 		die "$RESOLVEMSG"
 	fi
 
-	cmt=`cat $dotest/current`
+	cmt=`cat "$dotest/current"`
 	if ! git diff-index --quiet HEAD
 	then
 		if ! git-commit -C "$cmt"
@@ -84,14 +84,14 @@ continue_merge () {
 }
 
 call_merge () {
-	cmt="$(cat $dotest/cmt.$1)"
+	cmt="$(cat "$dotest/cmt.$1")"
 	echo "$cmt" > "$dotest/current"
 	hd=$(git rev-parse --verify HEAD)
 	cmt_name=$(git symbolic-ref HEAD)
-	msgnum=$(cat $dotest/msgnum)
-	end=$(cat $dotest/end)
+	msgnum=$(cat "$dotest/msgnum")
+	end=$(cat "$dotest/end")
 	eval GITHEAD_$cmt='"${cmt_name##refs/heads/}~$(($end - $msgnum))"'
-	eval GITHEAD_$hd='"$(cat $dotest/onto_name)"'
+	eval GITHEAD_$hd='$(cat "$dotest/onto_name")'
 	export GITHEAD_$cmt GITHEAD_$hd
 	git-merge-$strategy "$cmt^" -- "$hd" "$cmt"
 	rv=$?
@@ -140,10 +140,10 @@ do
 		}
 		if test -d "$dotest"
 		then
-			prev_head="`cat $dotest/prev_head`"
-			end="`cat $dotest/end`"
-			msgnum="`cat $dotest/msgnum`"
-			onto="`cat $dotest/onto`"
+			prev_head=$(cat "$dotest/prev_head")
+			end=$(cat "$dotest/end")
+			msgnum=$(cat "$dotest/msgnum")
+			onto=$(cat "$dotest/onto")
 			continue_merge
 			while test "$msgnum" -le "$end"
 			do
@@ -160,11 +160,11 @@ do
 		if test -d "$dotest"
 		then
 			git rerere clear
-			prev_head="`cat $dotest/prev_head`"
-			end="`cat $dotest/end`"
-			msgnum="`cat $dotest/msgnum`"
+			prev_head=$(cat "$dotest/prev_head")
+			end=$(cat "$dotest/end")
+			msgnum=$(cat "$dotest/msgnum")
 			msgnum=$(($msgnum + 1))
-			onto="`cat $dotest/onto`"
+			onto=$(cat "$dotest/onto")
 			while test "$msgnum" -le "$end"
 			do
 				call_merge "$msgnum"
Signature · 1 line
1.5.3.1
#23 lore raw

PATCH 2/2 Quoting paths in tests

From: Jonathan del Strother <[email protected]>

Double-quoting all paths so the tests can be run from inside directories with spaces and apostrophes

---
 t/lib-git-svn.sh                         |    2 +-
 t/t1020-subdirectory.sh                  |   22 ++++++------
 t/t3050-subprojects-fetch.sh             |    2 +-
 t/t3404-rebase-interactive.sh            |    2 +-
 t/t5500-fetch-pack.sh                    |    2 +-
 t/t5700-clone-reference.sh               |    2 +-
 t/t7003-filter-branch.sh                 |    2 +-
 t/t7501-commit.sh                        |    4 +-
 t/t9100-git-svn-basic.sh                 |   54 +++++++++++++++---------------
 t/t9101-git-svn-props.sh                 |    6 ++--
 t/t9102-git-svn-deep-rmdir.sh            |    6 ++--
 t/t9104-git-svn-follow-parent.sh         |   50 ++++++++++++++--------------
 t/t9105-git-svn-commit-diff.sh           |   12 +++---
 t/t9106-git-svn-commit-diff-clobber.sh   |   14 ++++----
 t/t9107-git-svn-migrate.sh               |   40 +++++++++++-----------
 t/t9108-git-svn-glob.sh                  |    8 ++--
 t/t9110-git-svn-use-svm-props.sh         |    8 ++--
 t/t9111-git-svn-use-svnsync-props.sh     |    8 ++--
 t/t9112-git-svn-md5less-file.sh          |    4 +-
 t/t9113-git-svn-dcommit-new-file.sh      |    6 ++--
 t/t9114-git-svn-dcommit-merge.sh         |    4 +-
 t/t9115-git-svn-dcommit-funky-renames.sh |    4 +-
 t/t9116-git-svn-log.sh                   |    4 +-
 t/t9500-gitweb-standalone-no-errors.sh   |    4 +-
 t/test-lib.sh                            |    2 +-
 25 files changed, 136 insertions(+), 136 deletions(-)
t/lib-git-svn.sh +1 -1
index 8d4a447..cde3053 100644
@@ -25,7 +25,7 @@ perl -w -e "
 use SVN::Core;
 use SVN::Repos;
 \$SVN::Core::VERSION gt '1.1.0' or exit(42);
-system(qw/svnadmin create --fs-type fsfs/, '$svnrepo') == 0 or exit(41);
+system(qw/svnadmin create --fs-type fsfs/, \"$svnrepo\") == 0 or exit(41);
 " >&3 2>&4
 x=$?
 if test $x -ne 0
t/t1020-subdirectory.sh +11 -11
index b9cef34..5ed7fa4 100755
@@ -21,7 +21,7 @@ LF='
 '
 
 test_expect_success 'update-index and ls-files' '
-	cd $HERE &&
+	cd "$HERE" &&
 	git update-index --add one &&
 	case "`git ls-files`" in
 	one) echo ok one ;;
@@ -41,7 +41,7 @@ test_expect_success 'update-index and ls-files' '
 '
 
 test_expect_success 'cat-file' '
-	cd $HERE &&
+	cd "$HERE" &&
 	two=`git ls-files -s dir/two` &&
 	two=`expr "$two" : "[0-7]* \\([0-9a-f]*\\)"` &&
 	echo "$two" &&
@@ -54,7 +54,7 @@ test_expect_success 'cat-file' '
 rm -f actual dir/actual
 
 test_expect_success 'diff-files' '
-	cd $HERE &&
+	cd "$HERE" &&
 	echo a >>one &&
 	echo d >>dir/two &&
 	case "`git diff-files --name-only`" in
@@ -74,7 +74,7 @@ test_expect_success 'diff-files' '
 '
 
 test_expect_success 'write-tree' '
-	cd $HERE &&
+	cd "$HERE" &&
 	top=`git write-tree` &&
 	echo $top &&
 	cd dir &&
@@ -84,7 +84,7 @@ test_expect_success 'write-tree' '
 '
 
 test_expect_success 'checkout-index' '
-	cd $HERE &&
+	cd "$HERE" &&
 	git checkout-index -f -u one &&
 	cmp one original.one &&
 	cd dir &&
@@ -93,7 +93,7 @@ test_expect_success 'checkout-index' '
 '
 
 test_expect_success 'read-tree' '
-	cd $HERE &&
+	cd "$HERE" &&
 	rm -f one dir/two &&
 	tree=`git write-tree` &&
 	git read-tree --reset -u "$tree" &&
@@ -107,27 +107,27 @@ test_expect_success 'read-tree' '
 '
 
 test_expect_success 'no file/rev ambiguity check inside .git' '
-	cd $HERE &&
+	cd "$HERE" &&
 	git commit -a -m 1 &&
-	cd $HERE/.git &&
+	cd "$HERE/.git" &&
 	git show -s HEAD
 '
 
 test_expect_success 'no file/rev ambiguity check inside a bare repo' '
-	cd $HERE &&
+	cd "$HERE" &&
 	git clone -s --bare .git foo.git &&
 	cd foo.git && GIT_DIR=. git show -s HEAD
 '
 
 # This still does not work as it should...
 : test_expect_success 'no file/rev ambiguity check inside a bare repo' '
-	cd $HERE &&
+	cd "$HERE" &&
 	git clone -s --bare .git foo.git &&
 	cd foo.git && git show -s HEAD
 '
 
 test_expect_success 'detection should not be fooled by a symlink' '
-	cd $HERE &&
+	cd "$HERE" &&
 	rm -fr foo.git &&
 	git clone -s .git another &&
 	ln -s another yetanother &&
t/t3050-subprojects-fetch.sh +1 -1
index 34f26a8..4b74cc6 100755
@@ -20,7 +20,7 @@ test_expect_success setup '
 '
 
 test_expect_success clone '
-	git clone file://`pwd`/.git cloned &&
+	git clone "file://`pwd`/.git" cloned &&
 	(git rev-parse HEAD; git ls-files -s) >expected &&
 	(
 		cd cloned &&
t/t3404-rebase-interactive.sh +1 -1
index 1113904..aa86042 100755
@@ -92,7 +92,7 @@ done
 EOF
 
 chmod a+x fake-editor.sh
-VISUAL="$(pwd)/fake-editor.sh"
+VISUAL="\"$(pwd)/fake-editor.sh\""
 export VISUAL
 
 test_expect_success 'no changes are a nop' '
t/t5500-fetch-pack.sh +1 -1
index 7b6798d..5489ffe 100755
@@ -129,7 +129,7 @@ pull_to_client 2nd "B" $((64*3))
 
 pull_to_client 3rd "A" $((1*3)) # old fails
 
-test_expect_success "clone shallow" "git-clone --depth 2 file://`pwd`/. shallow"
+test_expect_success "clone shallow" "git-clone --depth 2 \"file://`pwd`/.\" shallow"
 
 (cd shallow; git count-objects -v) > count.shallow
 
t/t5700-clone-reference.sh +1 -1
index 4e93aaa..8bb34f9 100755
@@ -51,7 +51,7 @@ diff expected current'
 cd "$base_dir"
 
 test_expect_success 'cloning with reference (no -l -s)' \
-'git clone --reference B file://`pwd`/A D'
+'git clone --reference B "file://`pwd`/A" D'
 
 cd "$base_dir"
 
t/t7003-filter-branch.sh +1 -1
index e935b20..1ab5392 100755
@@ -107,7 +107,7 @@ test_expect_success 'use index-filter to move into a subdirectory' '
 		 "git ls-files -s | sed \"s-\\t-&newsubdir/-\" |
 	          GIT_INDEX_FILE=\$GIT_INDEX_FILE.new \
 			git update-index --index-info &&
-		  mv \$GIT_INDEX_FILE.new \$GIT_INDEX_FILE" directorymoved &&
+		  mv \"\$GIT_INDEX_FILE.new\" \"\$GIT_INDEX_FILE\"" directorymoved &&
 	test -z "$(git diff HEAD directorymoved:newsubdir)"'
 
 test_expect_success 'stops when msg filter fails' '
t/t7501-commit.sh +2 -2
index b151b51..e97e756 100644
@@ -69,7 +69,7 @@ test_expect_success \
 
 cat >editor <<\EOF
 #!/bin/sh
-sed -i -e "s/a file/an amend commit/g" $1
+sed -i -e "s/a file/an amend commit/g" "$1"
 EOF
 chmod 755 editor
 
@@ -88,7 +88,7 @@ test_expect_success \
 
 cat >editor <<\EOF
 #!/bin/sh
-sed -i -e "s/amend/older/g" $1
+sed -i -e "s/amend/older/g" "$1"
 EOF
 chmod 755 editor
 
t/t9100-git-svn-basic.sh +27 -27

145 lines not on this page · raw message

t/t9101-git-svn-props.sh +3 -3
index 5aac644..e741bfe 100755
@@ -52,7 +52,7 @@ EOF
 cd ..
 
 rm -rf import
-test_expect_success 'checkout working copy from svn' "svn co $svnrepo test_wc"
+test_expect_success 'checkout working copy from svn' "svn co \"$svnrepo\" test_wc"
 test_expect_success 'setup some commits to svn' \
 	'cd test_wc &&
 		echo Greetings >> kw.c &&
@@ -66,7 +66,7 @@ test_expect_success 'setup some commits to svn' \
 		svn commit -m "Propset Id" &&
 	cd ..'
 
-test_expect_success 'initialize git-svn' "git-svn init $svnrepo"
+test_expect_success 'initialize git-svn' "git-svn init \"$svnrepo\""
 test_expect_success 'fetch revisions from svn' 'git-svn fetch'
 
 name='test svn:keywords ignoring'
@@ -92,7 +92,7 @@ test_expect_success "propset CR on crlf files" \
 test_expect_success 'fetch and pull latest from svn and checkout a new wc' \
 	"git-svn fetch &&
 	 git pull . remotes/git-svn &&
-	 svn co $svnrepo new_wc"
+	 svn co \"$svnrepo\" new_wc"
 
 for i in crlf ne_crlf lf ne_lf cr ne_cr empty_cr empty_lf empty empty_crlf
 do
t/t9102-git-svn-deep-rmdir.sh +3 -3
index 4e08083..e3af319 100755
@@ -9,12 +9,12 @@ test_expect_success 'initialize repo' "
 	mkdir -p deeply/nested/directory/number/2 &&
 	echo foo > deeply/nested/directory/number/1/file &&
 	echo foo > deeply/nested/directory/number/2/another &&
-	svn import -m 'import for git-svn' . $svnrepo &&
+	svn import -m 'import for git-svn' . \"$svnrepo\" &&
 	cd ..
 	"
 
 test_expect_success 'mirror via git-svn' "
-	git-svn init $svnrepo &&
+	git-svn init \"$svnrepo\" &&
 	git-svn fetch &&
 	git checkout -f -b test-rmdir remotes/git-svn
 	"
@@ -23,7 +23,7 @@ test_expect_success 'Try a commit on rmdir' "
 	git rm -f deeply/nested/directory/number/2/another &&
 	git commit -a -m 'remove another' &&
 	git-svn set-tree --rmdir HEAD &&
-	svn ls -R $svnrepo | grep ^deeply/nested/directory/number/1
+	svn ls -R \"$svnrepo\" | grep ^deeply/nested/directory/number/1
 	"
 
 
t/t9104-git-svn-follow-parent.sh +25 -25

130 lines not on this page · raw message

t/t9105-git-svn-commit-diff.sh +6 -6
index 318e172..9cc38d3 100755
@@ -8,7 +8,7 @@ test_expect_success 'initialize repo' "
 	mkdir import &&
 	cd import &&
 	echo hello > readme &&
-	svn import -m 'initial' . $svnrepo &&
+	svn import -m 'initial' . \"$svnrepo\" &&
 	cd .. &&
 	echo hello > readme &&
 	git update-index --add readme &&
@@ -26,17 +26,17 @@ prev=`git rev-parse --verify HEAD^1`
 
 test_expect_success 'test the commit-diff command' "
 	test -n '$prev' && test -n '$head' &&
-	git-svn commit-diff -r1 '$prev' '$head' '$svnrepo' &&
-	svn co $svnrepo wc &&
+	git-svn commit-diff -r1 '$prev' '$head' \"$svnrepo\" &&
+	svn co \"$svnrepo\" wc &&
 	cmp readme wc/readme
 	"
 
 test_expect_success 'commit-diff to a sub-directory (with git-svn config)' "
-	svn import -m 'sub-directory' import $svnrepo/subdir &&
-	git-svn init --minimize-url $svnrepo/subdir &&
+	svn import -m 'sub-directory' import \"$svnrepo/subdir\" &&
+	git-svn init --minimize-url \"$svnrepo/subdir\" &&
 	git-svn fetch &&
 	git-svn commit-diff -r3 '$prev' '$head' &&
-	svn cat $svnrepo/subdir/readme > readme.2 &&
+	svn cat \"$svnrepo/subdir/readme\" > readme.2 &&
 	cmp readme readme.2
 	"
 
t/t9106-git-svn-commit-diff-clobber.sh +7 -7
index 79b7968..892ca55 100755
@@ -8,14 +8,14 @@ test_expect_success 'initialize repo' "
 	mkdir import &&
 	cd import &&
 	echo initial > file &&
-	svn import -m 'initial' . $svnrepo &&
+	svn import -m 'initial' . \"$svnrepo\" &&
 	cd .. &&
 	echo initial > file &&
 	git update-index --add file &&
 	git commit -a -m 'initial'
 	"
 test_expect_success 'commit change from svn side' "
-	svn co $svnrepo t.svn &&
+	svn co \"$svnrepo\" t.svn &&
 	cd t.svn &&
 	echo second line from svn >> file &&
 	poke file &&
@@ -27,7 +27,7 @@ test_expect_success 'commit change from svn side' "
 test_expect_failure 'commit conflicting change from git' "
 	echo second line from git >> file &&
 	git commit -a -m 'second line from git' &&
-	git-svn commit-diff -r1 HEAD~1 HEAD $svnrepo
+	git-svn commit-diff -r1 HEAD~1 HEAD \"$svnrepo\"
 	" || true
 
 test_expect_success 'commit complementing change from git' "
@@ -36,14 +36,14 @@ test_expect_success 'commit complementing change from git' "
 	git commit -a -m 'second line from svn' &&
 	echo third line from git >> file &&
 	git commit -a -m 'third line from git' &&
-	git-svn commit-diff -r2 HEAD~1 HEAD $svnrepo
+	git-svn commit-diff -r2 HEAD~1 HEAD \"$svnrepo\"
 	"
 
 test_expect_failure 'dcommit fails to commit because of conflict' "
-	git-svn init $svnrepo &&
+	git-svn init \"$svnrepo\" &&
 	git-svn fetch &&
 	git reset --hard refs/remotes/git-svn &&
-	svn co $svnrepo t.svn &&
+	svn co \"$svnrepo\" t.svn &&
 	cd t.svn &&
 	echo fourth line from svn >> file &&
 	poke file &&
@@ -67,7 +67,7 @@ test_expect_success 'dcommit does the svn equivalent of an index merge' "
 	"
 
 test_expect_success 'commit another change from svn side' "
-	svn co $svnrepo t.svn &&
+	svn co \"$svnrepo\" t.svn &&
 	cd t.svn &&
 		echo third line from svn >> file &&
 		poke file &&
t/t9107-git-svn-migrate.sh +20 -20
index 67fdf70..59e8f0d 100755
@@ -4,7 +4,7 @@ test_description='git-svn metadata migrations from previous versions'
 . ./lib-git-svn.sh
 
 test_expect_success 'setup old-looking metadata' "
-	cp $GIT_DIR/config $GIT_DIR/config-old-git-svn &&
+	cp \"$GIT_DIR/config\" \"$GIT_DIR/config-old-git-svn\" &&
 	mkdir import &&
 	cd import &&
 		for i in trunk branches/a branches/b \
@@ -12,13 +12,13 @@ test_expect_success 'setup old-looking metadata' "
 			mkdir -p \$i && \
 			echo hello >> \$i/README || exit 1
 		done && \
-		svn import -m test . $svnrepo
+		svn import -m test . \"$svnrepo\"
 		cd .. &&
-	git-svn init $svnrepo &&
+	git-svn init \"$svnrepo\" &&
 	git-svn fetch &&
-	mv $GIT_DIR/svn/* $GIT_DIR/ &&
-	mv $GIT_DIR/svn/.metadata $GIT_DIR/ &&
-	rmdir $GIT_DIR/svn &&
+	mv \"$GIT_DIR\"/svn/* \"$GIT_DIR/\" &&
+	mv \"$GIT_DIR/svn/.metadata\" \"$GIT_DIR/\" &&
+	rmdir \"$GIT_DIR/svn\" &&
 	git update-ref refs/heads/git-svn-HEAD refs/remotes/git-svn &&
 	git update-ref refs/heads/svn-HEAD refs/remotes/git-svn &&
 	git update-ref -d refs/remotes/git-svn refs/remotes/git-svn
@@ -28,20 +28,20 @@ head=`git rev-parse --verify refs/heads/git-svn-HEAD^0`
 test_expect_success 'git-svn-HEAD is a real HEAD' "test -n '$head'"
 
 test_expect_success 'initialize old-style (v0) git-svn layout' "
-	mkdir -p $GIT_DIR/git-svn/info $GIT_DIR/svn/info &&
-	echo $svnrepo > $GIT_DIR/git-svn/info/url &&
-	echo $svnrepo > $GIT_DIR/svn/info/url &&
+	mkdir -p \"$GIT_DIR/git-svn/info\" \"$GIT_DIR/svn/info\" &&
+	echo \"$svnrepo\" > \"$GIT_DIR/git-svn/info/url\" &&
+	echo \"$svnrepo\" > \"$GIT_DIR/svn/info/url\" &&
 	git-svn migrate &&
-	! test -d $GIT_DIR/git-svn &&
+	! test -d \"$GIT_DIR/git-svn\" &&
 	git rev-parse --verify refs/remotes/git-svn^0 &&
 	git rev-parse --verify refs/remotes/svn^0 &&
-	test \`git config --get svn-remote.svn.url\` = '$svnrepo' &&
+	test \"\`git config --get svn-remote.svn.url\`\" = \"$svnrepo\" &&
 	test \`git config --get svn-remote.svn.fetch\` = \
              ':refs/remotes/git-svn'
 	"
 
 test_expect_success 'initialize a multi-repository repo' "
-	git-svn init $svnrepo -T trunk -t tags -b branches &&
+	git-svn init \"$svnrepo\" -T trunk -t tags -b branches &&
 	git config --get-all svn-remote.svn.fetch > fetch.out &&
 	grep '^trunk:refs/remotes/trunk$' fetch.out &&
 	test -n \"\`git config --get svn-remote.svn.branches \
@@ -76,14 +76,14 @@ test_expect_success 'multi-fetch works on partial urls + paths' "
 test_expect_success 'migrate --minimize on old inited layout' "
 	git config --unset-all svn-remote.svn.fetch &&
 	git config --unset-all svn-remote.svn.url &&
-	rm -rf $GIT_DIR/svn &&
+	rm -rf \"$GIT_DIR/svn\" &&
 	for i in \`cat fetch.out\`; do
 		path=\`expr \$i : '\\([^:]*\\):.*$'\`
 		ref=\`expr \$i : '[^:]*:refs/remotes/\\(.*\\)$'\`
 		if test -z \"\$ref\"; then continue; fi
 		if test -n \"\$path\"; then path=\"/\$path\"; fi
-		( mkdir -p $GIT_DIR/svn/\$ref/info/ &&
-		echo $svnrepo\$path > $GIT_DIR/svn/\$ref/info/url ) || exit 1;
+		( mkdir -p \"$GIT_DIR\"/svn/\$ref/info/ &&
+		echo \"$svnrepo\"\$path > \"$GIT_DIR\"/svn/\$ref/info/url ) || exit 1;
 	done &&
 	git-svn migrate --minimize &&
 	test -z \"\`git config -l |grep -v '^svn-remote\.git-svn\.'\`\" &&
@@ -99,13 +99,13 @@ test_expect_success 'migrate --minimize on old inited layout' "
 
 test_expect_success  ".rev_db auto-converted to .rev_db.UUID" "
 	git-svn fetch -i trunk &&
-	expect=$GIT_DIR/svn/trunk/.rev_db.* &&
+	expect=\"\`find \"\$GIT_DIR\"/svn/trunk/ -name '.rev_db.*'\`\" &&
 	test -n \"\$expect\" &&
-	mv \$expect $GIT_DIR/svn/trunk/.rev_db &&
+	mv \"\$expect\" \"\$GIT_DIR\"/svn/trunk/.rev_db &&
 	git-svn fetch -i trunk &&
-	test -L $GIT_DIR/svn/trunk/.rev_db &&
-	test -f \$expect &&
-	cmp \$expect $GIT_DIR/svn/trunk/.rev_db
+	test -L \"\$GIT_DIR\"/svn/trunk/.rev_db &&
+	test -f \"\$expect\" &&
+	cmp \"\$expect\" \"\$GIT_DIR\"/svn/trunk/.rev_db
 	"
 
 test_done
t/t9108-git-svn-glob.sh +4 -4
index db4344c..eb039ef 100755
@@ -14,8 +14,8 @@ test_expect_success 'test refspec globbing' "
 	mkdir -p trunk/src/a trunk/src/b trunk/doc &&
 	echo 'hello world' > trunk/src/a/readme &&
 	echo 'goodbye world' > trunk/src/b/readme &&
-	svn import -m 'initial' trunk $svnrepo/trunk &&
-	svn co $svnrepo tmp &&
+	svn import -m 'initial' trunk \"$svnrepo/trunk\" &&
+	svn co \"$svnrepo\" tmp &&
 	cd tmp &&
 		mkdir branches tags &&
 		svn add branches tags &&
@@ -38,7 +38,7 @@ test_expect_success 'test refspec globbing' "
 		poke tags/end/src/b/readme &&
 		svn commit -m 'nothing to see here'
 		cd .. &&
-	git config --add svn-remote.svn.url $svnrepo &&
+	git config --add svn-remote.svn.url \"$svnrepo\" &&
 	git config --add svn-remote.svn.fetch \
 	                 'trunk/src/a:refs/remotes/trunk' &&
 	git config --add svn-remote.svn.branches \
@@ -60,7 +60,7 @@ echo nothing to see here >> expect.two
 cat expect.end >> expect.two
 
 test_expect_success 'test left-hand-side only globbing' "
-	git config --add svn-remote.two.url $svnrepo &&
+	git config --add svn-remote.two.url \"$svnrepo\" &&
 	git config --add svn-remote.two.fetch trunk:refs/remotes/two/trunk &&
 	git config --add svn-remote.two.branches \
 	                 'branches/*:refs/remotes/two/branches/*' &&
t/t9110-git-svn-use-svm-props.sh +4 -4
index 6235af4..9df60ba 100755
@@ -8,11 +8,11 @@ test_description='git-svn useSvmProps test'
 . ./lib-git-svn.sh
 
 test_expect_success 'load svm repo' "
-	svnadmin load -q $rawsvnrepo < ../t9110/svm.dump &&
-	git-svn init --minimize-url -R arr -i bar $svnrepo/mirror/arr &&
-	git-svn init --minimize-url -R argh -i dir $svnrepo/mirror/argh &&
+	svnadmin load -q \"$rawsvnrepo\" < ../t9110/svm.dump &&
+	git-svn init --minimize-url -R arr -i bar \"$svnrepo/mirror/arr\" &&
+	git-svn init --minimize-url -R argh -i dir \"$svnrepo/mirror/argh\" &&
 	git-svn init --minimize-url -R argh -i e \
-	  $svnrepo/mirror/argh/a/b/c/d/e &&
+	  \"$svnrepo/mirror/argh/a/b/c/d/e\" &&
 	git config svn.useSvmProps true &&
 	git-svn fetch --all
 	"
t/t9111-git-svn-use-svnsync-props.sh +4 -4
index ec7dedd..e3693eb 100755
@@ -8,10 +8,10 @@ test_description='git-svn useSvnsyncProps test'
 . ./lib-git-svn.sh
 
 test_expect_success 'load svnsync repo' "
-	svnadmin load -q $rawsvnrepo < ../t9111/svnsync.dump &&
-	git-svn init --minimize-url -R arr -i bar $svnrepo/bar &&
-	git-svn init --minimize-url -R argh -i dir $svnrepo/dir &&
-	git-svn init --minimize-url -R argh -i e $svnrepo/dir/a/b/c/d/e &&
+	svnadmin load -q \"$rawsvnrepo\" < ../t9111/svnsync.dump &&
+	git-svn init --minimize-url -R arr -i bar \"$svnrepo/bar\" &&
+	git-svn init --minimize-url -R argh -i dir \"$svnrepo/dir\" &&
+	git-svn init --minimize-url -R argh -i e \"$svnrepo/dir/a/b/c/d/e\" &&
 	git config svn.useSvnsyncProps true &&
 	git-svn fetch --all
 	"
t/t9112-git-svn-md5less-file.sh +2 -2
index 08313bb..124120c 100755
@@ -38,8 +38,8 @@ PROPS-END
 
 EOF
 
-test_expect_success 'load svn dumpfile' "svnadmin load $rawsvnrepo < dumpfile.svn"
+test_expect_success 'load svn dumpfile' "svnadmin load \"$rawsvnrepo\" < dumpfile.svn"
 
-test_expect_success 'initialize git-svn' "git-svn init $svnrepo"
+test_expect_success 'initialize git-svn' "git-svn init \"$svnrepo\""
 test_expect_success 'fetch revisions from svn' 'git-svn fetch'
 test_done
t/t9113-git-svn-dcommit-new-file.sh +3 -3
index 9ef0db9..150d7f0 100755
@@ -15,14 +15,14 @@ test_description='git-svn dcommit new files over svn:// test'
 
 start_svnserve () {
 	svnserve --listen-port $SVNSERVE_PORT \
-	         --root $rawsvnrepo \
+	         --root "$rawsvnrepo" \
 	         --listen-once \
 	         --listen-host 127.0.0.1 &
 }
 
 test_expect_success 'start tracking an empty repo' "
-	svn mkdir -m 'empty dir' $svnrepo/empty-dir &&
-	echo anon-access = write >> $rawsvnrepo/conf/svnserve.conf &&
+	svn mkdir -m 'empty dir' \"$svnrepo/empty-dir\" &&
+	echo anon-access = write >> \"$rawsvnrepo/conf/svnserve.conf\" &&
 	start_svnserve &&
 	git svn init svn://127.0.0.1:$SVNSERVE_PORT &&
 	git svn fetch
t/t9114-git-svn-dcommit-merge.sh +2 -2
index d6ca955..ffe8859 100755
@@ -35,7 +35,7 @@ EOF
 }
 
 test_expect_success 'setup svn repository' "
-	svn co $svnrepo mysvnwork &&
+	svn co \"$svnrepo\" mysvnwork &&
 	mkdir -p mysvnwork/trunk &&
 	cd mysvnwork &&
 		big_text_block >> trunk/README &&
@@ -45,7 +45,7 @@ test_expect_success 'setup svn repository' "
 	"
 
 test_expect_success 'setup git mirror and merge' "
-	git svn init $svnrepo -t tags -T trunk -b branches &&
+	git svn init \"$svnrepo\" -t tags -T trunk -b branches &&
 	git svn fetch &&
 	git checkout --track -b svn remotes/trunk &&
 	git checkout -b merge &&
t/t9115-git-svn-dcommit-funky-renames.sh +2 -2
index 182299c..0681ffa 100755
@@ -8,12 +8,12 @@ test_description='git-svn dcommit can commit renames of files with ugly names'
 . ./lib-git-svn.sh
 
 test_expect_success 'load repository with strange names' "
-	svnadmin load -q $rawsvnrepo < ../t9115/funky-names.dump &&
+	svnadmin load -q \"$rawsvnrepo\" < ../t9115/funky-names.dump &&
 	start_httpd
 	"
 
 test_expect_success 'init and fetch repository' "
-	git svn init $svnrepo &&
+	git svn init \"$svnrepo\" &&
 	git svn fetch &&
 	git reset --hard git-svn
 	"
t/t9116-git-svn-log.sh +2 -2
index 0d4e6b3..890b5f1 100755
@@ -14,9 +14,9 @@ test_expect_success 'setup repository and import' "
 			mkdir -p \$i && \
 			echo hello >> \$i/README || exit 1
 		done && \
-		svn import -m test . $svnrepo
+		svn import -m test . \"$svnrepo\"
 		cd .. &&
-	git-svn init $svnrepo -T trunk -b branches -t tags &&
+	git-svn init \"$svnrepo\" -T trunk -b branches -t tags &&
 	git-svn fetch &&
 	git reset --hard trunk &&
 	echo bye >> README &&
t/t9500-gitweb-standalone-no-errors.sh +2 -2
index 642b836..b90e78c 100755
@@ -45,13 +45,13 @@ gitweb_run () {
 	export QUERY_STRING=""$1""
 	export PATH_INFO=""$2""
 
-	export GITWEB_CONFIG=$(pwd)/gitweb_config.perl
+	export GITWEB_CONFIG="$(pwd)/gitweb_config.perl"
 
 	# some of git commands write to STDERR on error, but this is not
 	# written to web server logs, so we are not interested in that:
 	# we are interested only in properly formatted errors/warnings
 	rm -f gitweb.log &&
-	perl -- $(pwd)/../../gitweb/gitweb.perl \
+	perl -- "$(pwd)/../../gitweb/gitweb.perl" \
 		>/dev/null 2>gitweb.log &&
 	if grep -q -s "^[[]" gitweb.log >/dev/null; then false; else true; fi
 
t/test-lib.sh +1 -1
index cc1253c..a68415f 100644
@@ -229,7 +229,7 @@ test_create_repo () {
 	repo="$1"
 	mkdir "$repo"
 	cd "$repo" || error "Cannot setup test environment"
-	"$GIT_EXEC_PATH/git" init --template=$GIT_EXEC_PATH/templates/blt/ >/dev/null 2>&1 ||
+	"$GIT_EXEC_PATH/git" init --template="$GIT_EXEC_PATH/templates/blt/" >/dev/null 2>&1 ||
 	error "cannot run git init -- have you built things yet?"
 	mv .git/hooks .git/hooks-disabled
 	cd "$owd"
Signature · 1 line
1.5.3.1
#24 lore raw

Re: [PATCH 2/2] Quoting paths in tests

t/lib-git-svn.sh perl -w -e " · line 28

Quoted 8 lines · Jonathan del Strother
t/lib-git-svn.sh +1 -1
@@ -25,7 +25,7 @@ perl -w -e "
 use SVN::Core;
 use SVN::Repos;
 \$SVN::Core::VERSION gt '1.1.0' or exit(42);
-system(qw/svnadmin create --fs-type fsfs/, '$svnrepo') == 0 or exit(41);
+system(qw/svnadmin create --fs-type fsfs/, \"$svnrepo\") == 0 or exit(41);

Here you have to work harder: The reason is that this is part of a perl expression (as opposed to an eval'd string), which does not have access to $svnrepo of the shell by which it is invoked. The original version failed if there were single-quotes in $svnrepo, the new version fails if it contains double-quotes.

t/lib-git-svn.sh perl -w -e "

Quoted 5 lines
t/lib-git-svn.sh +1 -1
 " >&3 2>&4
 
 
-	svn import -m 'import for git-svn' . $svnrepo >/dev/null &&
+	svn import -m 'import for git-svn' . \"$svnrepo\" >/dev/null &&

This must be

	svn import -m 'import for git-svn' . \"\$svnrepo\" >/dev/null &&

to be safe. Your version would break with names with double-quotes, because $svnrepo would be expanded and then eval'd inside test_expect_*. This error recurs numerous times until the end of the patch.

May I recommend that you run the test suite in a directory named like this:

	$ mkdir \"\ \$GIT_DIR\ \'
	$ ls
	" $GIT_DIR '

t/lib-git-svn.sh

Quoted 4 lines
t/lib-git-svn.sh +2 -2
-		( mkdir -p $GIT_DIR/svn/\$ref/info/ &&
-		echo $svnrepo\$path > $GIT_DIR/svn/\$ref/info/url ) || exit 1;
+		( mkdir -p \"$GIT_DIR\"/svn/\$ref/info/ &&
+		echo \"$svnrepo\"\$path > \"$GIT_DIR\"/svn/\$ref/info/url ) || exit 1;

I assume $path is under control of the test script, otherwise it must be inside the double-quotes, too.

t/lib-git-svn.sh

Quoted 4 lines

test_expect_success ".rev_db auto-converted to .rev_db.UUID" "

t/lib-git-svn.sh +1 -1
 	git-svn fetch -i trunk &&
-	expect=$GIT_DIR/svn/trunk/.rev_db.* &&
+	expect=\"\`find \"\$GIT_DIR\"/svn/trunk/ -name '.rev_db.*'\`\" &&

Why is this trickery with find needed? Isn't it easier to put the whole test case in single-quotes instead?

-- Hannes

#25 lore raw

Re: [PATCH 2/2] Quoting paths in tests

Quoted 13 lines · Johannes Sixt

t/lib-git-svn.sh perl -w -e " · line 30

Quoted 10 lines · Jonathan del Strother
t/lib-git-svn.sh +1 -1
@@ -25,7 +25,7 @@ perl -w -e "
 use SVN::Core;
 use SVN::Repos;
 \$SVN::Core::VERSION gt '1.1.0' or exit(42);
-system(qw/svnadmin create --fs-type fsfs/, '$svnrepo') == 0 or  
 exit(41);
+system(qw/svnadmin create --fs-type fsfs/, \"$svnrepo\") == 0 or  
 exit(41);

Here you have to work harder: The reason is that this is part of a perl expression (as opposed to an eval'd string), which does not have access to $svnrepo of the shell by which it is invoked. The original version failed if there were single-quotes in $svnrepo, the new version fails if it contains double-quotes.

...

Quoted 6 lines

May I recommend that you run the test suite in a directory named like this:

	$ mkdir \"\ \$GIT_DIR\ \'
	$ ls
	" $GIT_DIR '

Eww. I'm struggling a bit with paths this perverse, actually.

For instance, git_editor in git-sh-setup expects the editor path to be pre-quoted. So in t3404, you need to produce escaped double quotes & dollar signs, resulting in unpleasantness like this :

VISUAL="pwd/fake-editor.sh"
VISUAL=${VISUAL//\"/\\\"}
VISUAL=${VISUAL//$/\\\$}
VISUAL=\"$VISUAL\"
export VISUAL

And I'm struggling to come up with neat ways of rewriting things like, eg, this bit from t5500 - test_expect_success "clone shallow" "git-clone --depth 2 \"file://pwd/.\" shallow"
- to handle paths like that properly.

Suggestions?

Jon

#26 lore raw

Re: [PATCH 2/2] Quoting paths in tests

Quoted 4 lines · Jonathan del Strother
Quoted 1 line · Johannes Sixt

Jonathan del Strother schrieb:

Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
t/lib-git-svn.sh +0 -0
@@ -25,7 +25,7 @@ perl -w -e "
 use SVN::Core;
Quoted 8 lines

t/lib-git-svn.sh perl -w -e " · line 30

Quoted 6 lines
t/lib-git-svn.sh +1 -1
 use SVN::Repos;
 \$SVN::Core::VERSION gt '1.1.0' or exit(42);
-system(qw/svnadmin create --fs-type fsfs/, '$svnrepo') == 0 or 
 exit(41);
+system(qw/svnadmin create --fs-type fsfs/, \"$svnrepo\") == 0 or 
 exit(41);

Here you have to work harder: The reason is that this is part of a perl expression (as opposed to an eval'd string), which does not have access to $svnrepo of the shell by which it is invoked. The original version failed if there were single-quotes in $svnrepo, the new version fails if it contains double-quotes.

You can rewrite this expression as

    perl -w -e '$svnrepo = shift;
	...
	$SVN::Core::Version gt "1.1.0" ...
	system(qw/svnadmin create --fs-type fsfs/, $svnrepo) == 0 ...
	...
    ' >&3 2>&4 "$svnrepo"

i.e. you pass the repository name as an argument to the scriptlet.

Quoted 7 lines
Quoted 5 lines

May I recommend that you run the test suite in a directory named like this:

    $ mkdir \"\ \$GIT_DIR\ \'
    $ ls
    " $GIT_DIR '
Quoted 7 lines

Eww. I'm struggling a bit with paths this perverse, actually.

For instance, git_editor in git-sh-setup expects the editor path to be pre-quoted. So in t3404, you need to produce escaped double quotes & dollar signs, resulting in unpleasantness like this :

VISUAL="pwd/fake-editor.sh"
VISUAL=${VISUAL//\"/\\\"}
VISUAL=${VISUAL//$/\\\$}

This is a bashism - that's a big no-no.

Quoted 7 lines

VISUAL=\"$VISUAL\"
export VISUAL

And I'm struggling to come up with neat ways of rewriting things like, eg, this bit from t5500 - test_expect_success "clone shallow" "git-clone --depth 2 \"file://pwd/.\" shallow"
- to handle paths like that properly.

These examples expand pwd too early. Can't you just put everything inside single-quotes? Although I'm not sure about VISUAL: Is it invoked with $PWD that is different from $PWD when VISUAL is defined? If so, then you can hardly delay pwd...

I know I'm a bit anal with my criticism. I reviewed your patch because I think fixing for paths with whitespace is worthwhile. However, I also think any fix should go the full way and not only shift the problems into a different corner. Maybe a word from $maintainer would be in order ;)

-- Hannes

#27 lore raw

Re: [PATCH 2/2] Quoting paths in tests

Quoted 45 lines · Johannes Sixt
Quoted 14 lines · Jonathan del Strother
Quoted 13 lines · Johannes Sixt

t/lib-git-svn.sh perl -w -e " · line 30

Quoted 10 lines · Jonathan del Strother
t/lib-git-svn.sh +1 -1
@@ -25,7 +25,7 @@ perl -w -e "
 use SVN::Core;
 use SVN::Repos;
 \$SVN::Core::VERSION gt '1.1.0' or exit(42);
-system(qw/svnadmin create --fs-type fsfs/, '$svnrepo') == 0 or  
 exit(41);
+system(qw/svnadmin create --fs-type fsfs/, \"$svnrepo\") == 0 or  
 exit(41);

Here you have to work harder: The reason is that this is part of a perl expression (as opposed to an eval'd string), which does not have access to $svnrepo of the shell by which it is invoked. The original version failed if there were single-quotes in $svnrepo, the new version fails if it contains double-quotes.

You can rewrite this expression as

   perl -w -e '$svnrepo = shift;
	...
	$SVN::Core::Version gt "1.1.0" ...
	system(qw/svnadmin create --fs-type fsfs/, $svnrepo) == 0 ...
	...

' >&3 2>&4 "$svnrepo"

i.e. you pass the repository name as an argument to the scriptlet.

Quoted 10 lines
Quoted 5 lines

May I recommend that you run the test suite in a directory named like this:

   $ mkdir \"\ \$GIT_DIR\ \'
   $ ls
   " $GIT_DIR '

Eww. I'm struggling a bit with paths this perverse, actually.
For instance, git_editor in git-sh-setup expects the editor path to be pre-quoted. So in t3404, you need to produce escaped double quotes & dollar signs, resulting in unpleasantness like this :
VISUAL="pwd/fake-editor.sh"
VISUAL=${VISUAL//\"/\\\"}
VISUAL=${VISUAL//$/\\\$}

This is a bashism - that's a big no-no.

Quoted 5 lines

VISUAL=\"$VISUAL\"
export VISUAL
And I'm struggling to come up with neat ways of rewriting things like, eg, this bit from t5500 - test_expect_success "clone shallow" "git-clone --depth 2 \"file://pwd/.\" shallow"
- to handle paths like that properly.

Quoted 3 lines

These examples expand pwd too early. Can't you just put everything inside single-quotes? Although I'm not sure about VISUAL: Is it invoked with $PWD that is different from $PWD when VISUAL is defined? If so, then you can hardly delay pwd...

I know I'm a bit anal with my criticism. I reviewed your patch because I think fixing for paths with whitespace is worthwhile. However, I also think any fix should go the full way and not only shift the problems into a different corner. Maybe a word from $maintainer would be in order ;)

In theory, I agree that the tests should properly handle perverse paths, but it's beginning to stretch my shell scripting skills. So now our esteemed leader is back in business, any thoughts on how hard we want to work to quote things?

Also, from "What's cooking in git.git" :

Quoted 4 lines

I have a feeling that this should have forked off of 'maint'. The change looks obvious and trivial, so perhaps after getting a testcase (hint, hint) merge to 'master' and then cherry-pick to 'maint' as well.

Noted

Jon del Strother

#28 lore raw

Re: [PATCH 2/2] Quoting paths in tests

In reply to Jonathan del Strother
Quoted 35 lines · Jonathan del Strother
Quoted 17 lines · Johannes Sixt

t/lib-git-svn.sh perl -w -e " · line 30

Quoted 10 lines · Jonathan del Strother
t/lib-git-svn.sh +1 -1
@@ -25,7 +25,7 @@ perl -w -e "
 use SVN::Core;
 use SVN::Repos;
 \$SVN::Core::VERSION gt '1.1.0' or exit(42);
-system(qw/svnadmin create --fs-type fsfs/, '$svnrepo') == 0 or
 exit(41);
+system(qw/svnadmin create --fs-type fsfs/, \"$svnrepo\") == 0 or
 exit(41);

Here you have to work harder: The reason is that this is part of a perl expression (as opposed to an eval'd string), which does not have access to $svnrepo of the shell by which it is invoked. The original version failed if there were single-quotes in $svnrepo, the new version fails if it contains double-quotes.

...

Quoted 7 lines

May I recommend that you run the test suite in a directory named like this:

	$ mkdir \"\ \$GIT_DIR\ \'
	$ ls
	" $GIT_DIR '

Eww. I'm struggling a bit with paths this perverse, actually.

For instance, git_editor in git-sh-setup expects the editor path to be pre-quoted. So in t3404, you need to produce escaped double quotes & dollar signs, resulting in unpleasantness like this :

Quoted 5 lines

VISUAL="pwd/fake-editor.sh"
VISUAL=${VISUAL//\"/\\\"}
VISUAL=${VISUAL//$/\\\$}
VISUAL=\"$VISUAL\"
export VISUAL

EDITORPWD="pwd"
VISUAL='$EDITORPWD/fake-editor.sh'
export EDITORPWD VISUAL

Signature · 1 line
David Kastrup
#29 lore raw

Re: [PATCH 2/2] Quoting paths in tests

Quoted 12 lines · David Kastrup
Quoted 9 lines · Jonathan del Strother

For instance, git_editor in git-sh-setup expects the editor path to be pre-quoted. So in t3404, you need to produce escaped double quotes & dollar signs, resulting in unpleasantness like this :

VISUAL="pwd/fake-editor.sh"
VISUAL=${VISUAL//\"/\\\"}
VISUAL=${VISUAL//$/\\\$}
VISUAL=\"$VISUAL\"
export VISUAL

Quoted 3 lines

EDITORPWD="pwd"
VISUAL='$EDITORPWD/fake-editor.sh'
export EDITORPWD VISUAL

Pffffft.

VISUAL='"$EDITORPWD/fake-editor.sh"'

of course. Or we still have problems with spaces in pwd.

Signature · 1 line
David Kastrup, Kriemhildstr. 15, 44793 Bochum
#31 lore raw

PATCH 2/3 Quoting paths in tests

In reply to Andreas Ericsson

From: Jonathan del Strother <[email protected]>

Add quoting to various test paths so they can be run from a path with a space in

---
 t/lib-git-svn.sh                         |    2 +-
 t/t1020-subdirectory.sh                  |   22 ++++++------
 t/t3050-subprojects-fetch.sh             |    2 +-
 t/t3404-rebase-interactive.sh            |    2 +-
 t/t5500-fetch-pack.sh                    |    2 +-
 t/t5700-clone-reference.sh               |    2 +-
 t/t7003-filter-branch.sh                 |    2 +-
 t/t7501-commit.sh                        |    4 +-
 t/t9100-git-svn-basic.sh                 |   18 +++++-----
 t/t9101-git-svn-props.sh                 |    6 ++--
 t/t9102-git-svn-deep-rmdir.sh            |    6 ++--
 t/t9104-git-svn-follow-parent.sh         |   50 +++++++++++++++---------------
 t/t9105-git-svn-commit-diff.sh           |   10 +++---
 t/t9106-git-svn-commit-diff-clobber.sh   |   14 ++++----
 t/t9107-git-svn-migrate.sh               |   40 ++++++++++++------------
 t/t9108-git-svn-glob.sh                  |    8 ++--
 t/t9110-git-svn-use-svm-props.sh         |    8 ++--
 t/t9111-git-svn-use-svnsync-props.sh     |    8 ++--
 t/t9112-git-svn-md5less-file.sh          |    4 +-
 t/t9113-git-svn-dcommit-new-file.sh      |    6 ++--
 t/t9114-git-svn-dcommit-merge.sh         |    4 +-
 t/t9115-git-svn-dcommit-funky-renames.sh |    4 +-
 t/t9116-git-svn-log.sh                   |    4 +-
 t/t9500-gitweb-standalone-no-errors.sh   |    4 +-
 t/test-lib.sh                            |    2 +-
 25 files changed, 117 insertions(+), 117 deletions(-)
t/lib-git-svn.sh +1 -1
index 8d4a447..cde3053 100644
@@ -25,7 +25,7 @@ perl -w -e "
 use SVN::Core;
 use SVN::Repos;
 \$SVN::Core::VERSION gt '1.1.0' or exit(42);
-system(qw/svnadmin create --fs-type fsfs/, '$svnrepo') == 0 or exit(41);
+system(qw/svnadmin create --fs-type fsfs/, \"$svnrepo\") == 0 or exit(41);
 " >&3 2>&4
 x=$?
 if test $x -ne 0
t/t1020-subdirectory.sh +11 -11
index b9cef34..5ed7fa4 100755
@@ -21,7 +21,7 @@ LF='
 '
 
 test_expect_success 'update-index and ls-files' '
-	cd $HERE &&
+	cd "$HERE" &&
 	git update-index --add one &&
 	case "`git ls-files`" in
 	one) echo ok one ;;
@@ -41,7 +41,7 @@ test_expect_success 'update-index and ls-files' '
 '
 
 test_expect_success 'cat-file' '
-	cd $HERE &&
+	cd "$HERE" &&
 	two=`git ls-files -s dir/two` &&
 	two=`expr "$two" : "[0-7]* \\([0-9a-f]*\\)"` &&
 	echo "$two" &&
@@ -54,7 +54,7 @@ test_expect_success 'cat-file' '
 rm -f actual dir/actual
 
 test_expect_success 'diff-files' '
-	cd $HERE &&
+	cd "$HERE" &&
 	echo a >>one &&
 	echo d >>dir/two &&
 	case "`git diff-files --name-only`" in
@@ -74,7 +74,7 @@ test_expect_success 'diff-files' '
 '
 
 test_expect_success 'write-tree' '
-	cd $HERE &&
+	cd "$HERE" &&
 	top=`git write-tree` &&
 	echo $top &&
 	cd dir &&
@@ -84,7 +84,7 @@ test_expect_success 'write-tree' '
 '
 
 test_expect_success 'checkout-index' '
-	cd $HERE &&
+	cd "$HERE" &&
 	git checkout-index -f -u one &&
 	cmp one original.one &&
 	cd dir &&
@@ -93,7 +93,7 @@ test_expect_success 'checkout-index' '
 '
 
 test_expect_success 'read-tree' '
-	cd $HERE &&
+	cd "$HERE" &&
 	rm -f one dir/two &&
 	tree=`git write-tree` &&
 	git read-tree --reset -u "$tree" &&
@@ -107,27 +107,27 @@ test_expect_success 'read-tree' '
 '
 
 test_expect_success 'no file/rev ambiguity check inside .git' '
-	cd $HERE &&
+	cd "$HERE" &&
 	git commit -a -m 1 &&
-	cd $HERE/.git &&
+	cd "$HERE/.git" &&
 	git show -s HEAD
 '
 
 test_expect_success 'no file/rev ambiguity check inside a bare repo' '
-	cd $HERE &&
+	cd "$HERE" &&
 	git clone -s --bare .git foo.git &&
 	cd foo.git && GIT_DIR=. git show -s HEAD
 '
 
 # This still does not work as it should...
 : test_expect_success 'no file/rev ambiguity check inside a bare repo' '
-	cd $HERE &&
+	cd "$HERE" &&
 	git clone -s --bare .git foo.git &&
 	cd foo.git && git show -s HEAD
 '
 
 test_expect_success 'detection should not be fooled by a symlink' '
-	cd $HERE &&
+	cd "$HERE" &&
 	rm -fr foo.git &&
 	git clone -s .git another &&
 	ln -s another yetanother &&
t/t3050-subprojects-fetch.sh +1 -1
index 34f26a8..4b74cc6 100755
@@ -20,7 +20,7 @@ test_expect_success setup '
 '
 
 test_expect_success clone '
-	git clone file://`pwd`/.git cloned &&
+	git clone "file://`pwd`/.git" cloned &&
 	(git rev-parse HEAD; git ls-files -s) >expected &&
 	(
 		cd cloned &&
t/t3404-rebase-interactive.sh +1 -1
index 1113904..aa86042 100755
@@ -92,7 +92,7 @@ done
 EOF
 
 chmod a+x fake-editor.sh
-VISUAL="$(pwd)/fake-editor.sh"
+VISUAL="\"$(pwd)/fake-editor.sh\""
 export VISUAL
 
 test_expect_success 'no changes are a nop' '
t/t5500-fetch-pack.sh +1 -1
index 7b6798d..5489ffe 100755
@@ -129,7 +129,7 @@ pull_to_client 2nd "B" $((64*3))
 
 pull_to_client 3rd "A" $((1*3)) # old fails
 
-test_expect_success "clone shallow" "git-clone --depth 2 file://`pwd`/. shallow"
+test_expect_success "clone shallow" "git-clone --depth 2 \"file://`pwd`/.\" shallow"
 
 (cd shallow; git count-objects -v) > count.shallow
 
t/t5700-clone-reference.sh +1 -1
index 4e93aaa..8bb34f9 100755
@@ -51,7 +51,7 @@ diff expected current'
 cd "$base_dir"
 
 test_expect_success 'cloning with reference (no -l -s)' \
-'git clone --reference B file://`pwd`/A D'
+'git clone --reference B "file://`pwd`/A" D'
 
 cd "$base_dir"
 
t/t7003-filter-branch.sh +1 -1
index e935b20..1ab5392 100755
@@ -107,7 +107,7 @@ test_expect_success 'use index-filter to move into a subdirectory' '
 		 "git ls-files -s | sed \"s-\\t-&newsubdir/-\" |
 	          GIT_INDEX_FILE=\$GIT_INDEX_FILE.new \
 			git update-index --index-info &&
-		  mv \$GIT_INDEX_FILE.new \$GIT_INDEX_FILE" directorymoved &&
+		  mv \"\$GIT_INDEX_FILE.new\" \"\$GIT_INDEX_FILE\"" directorymoved &&
 	test -z "$(git diff HEAD directorymoved:newsubdir)"'
 
 test_expect_success 'stops when msg filter fails' '
t/t7501-commit.sh +2 -2
index b151b51..e97e756 100644
@@ -69,7 +69,7 @@ test_expect_success \
 
 cat >editor <<\EOF
 #!/bin/sh
-sed -i -e "s/a file/an amend commit/g" $1
+sed -i -e "s/a file/an amend commit/g" "$1"
 EOF
 chmod 755 editor
 
@@ -88,7 +88,7 @@ test_expect_success \
 
 cat >editor <<\EOF
 #!/bin/sh
-sed -i -e "s/amend/older/g" $1
+sed -i -e "s/amend/older/g" "$1"
 EOF
 chmod 755 editor
 
t/t9100-git-svn-basic.sh +9 -9
index 614cf50..c3585da 100755
@@ -31,16 +31,16 @@ test_expect_success \
 	echo 'zzz' > bar/zzz &&
 	echo '#!/bin/sh' > exec.sh &&
 	chmod +x exec.sh &&
-	svn import -m 'import for git-svn' . $svnrepo >/dev/null &&
+	svn import -m 'import for git-svn' . '$svnrepo' >/dev/null &&
 	cd .. &&
 	rm -rf import &&
-	git-svn init $svnrepo"
+	git-svn init '$svnrepo'"
 
 test_expect_success \
     'import an SVN revision into git' \
     'git-svn fetch'
 
-test_expect_success "checkout from svn" "svn co $svnrepo '$SVN_TREE'"
+test_expect_success "checkout from svn" "svn co '$svnrepo' '$SVN_TREE'"
 
 name='try a deep --rmdir with a commit'
 test_expect_success "$name" "
@@ -169,7 +169,7 @@ test_expect_success "$name" "
 	svn up '$SVN_TREE' &&
 	test -f '$SVN_TREE'/exec-2.sh &&
 	test ! -L '$SVN_TREE'/exec-2.sh &&
-	git diff help $SVN_TREE/exec-2.sh"
+	git diff help '$SVN_TREE/exec-2.sh'"
 
 if test "$have_utf8" = t
 then
@@ -190,7 +190,7 @@ name='test fetch functionality (svn => git) with alternate GIT_SVN_ID'
 GIT_SVN_ID=alt
 export GIT_SVN_ID
 test_expect_success "$name" \
-    "git-svn init $svnrepo && git-svn fetch &&
+    "git-svn init '$svnrepo' && git-svn fetch &&
      git rev-list --pretty=raw remotes/git-svn | grep ^tree | uniq > a &&
      git rev-list --pretty=raw remotes/alt | grep ^tree | uniq > b &&
      git diff a b"
@@ -220,16 +220,16 @@ test_expect_failure 'exit if remote refs are ambigious' "
         "
 
 test_expect_failure 'exit if init-ing a would clobber a URL' "
-        svnadmin create ${PWD}/svnrepo2 &&
-        svn mkdir -m 'mkdir bar' ${svnrepo}2/bar &&
+        svnadmin create '${PWD}/svnrepo2' &&
+        svn mkdir -m 'mkdir bar' '${svnrepo}2/bar' &&
         git config --unset svn-remote.svn.fetch \
                                 '^bar:refs/remotes/git-svn$' &&
-        git-svn init ${svnrepo}2/bar
+        git-svn init '${svnrepo}2/bar'
         "
 
 test_expect_success \
   'init allows us to connect to another directory in the same repo' "
-        git-svn init --minimize-url -i bar $svnrepo/bar &&
+        git-svn init --minimize-url -i bar '$svnrepo/bar' &&
         git config --get svn-remote.svn.fetch \
                               '^bar:refs/remotes/bar$' &&
         git config --get svn-remote.svn.fetch \
t/t9101-git-svn-props.sh +3 -3
index 5aac644..a1c85e0 100755
@@ -52,7 +52,7 @@ EOF
 cd ..
 
 rm -rf import
-test_expect_success 'checkout working copy from svn' "svn co $svnrepo test_wc"
+test_expect_success 'checkout working copy from svn' "svn co '$svnrepo' test_wc"
 test_expect_success 'setup some commits to svn' \
 	'cd test_wc &&
 		echo Greetings >> kw.c &&
@@ -66,7 +66,7 @@ test_expect_success 'setup some commits to svn' \
 		svn commit -m "Propset Id" &&
 	cd ..'
 
-test_expect_success 'initialize git-svn' "git-svn init $svnrepo"
+test_expect_success 'initialize git-svn' "git-svn init '$svnrepo'"
 test_expect_success 'fetch revisions from svn' 'git-svn fetch'
 
 name='test svn:keywords ignoring'
@@ -92,7 +92,7 @@ test_expect_success "propset CR on crlf files" \
 test_expect_success 'fetch and pull latest from svn and checkout a new wc' \
 	"git-svn fetch &&
 	 git pull . remotes/git-svn &&
-	 svn co $svnrepo new_wc"
+	 svn co '$svnrepo' new_wc"
 
 for i in crlf ne_crlf lf ne_lf cr ne_cr empty_cr empty_lf empty empty_crlf
 do
t/t9102-git-svn-deep-rmdir.sh +3 -3
index 4e08083..99c8840 100755
@@ -9,12 +9,12 @@ test_expect_success 'initialize repo' "
 	mkdir -p deeply/nested/directory/number/2 &&
 	echo foo > deeply/nested/directory/number/1/file &&
 	echo foo > deeply/nested/directory/number/2/another &&
-	svn import -m 'import for git-svn' . $svnrepo &&
+	svn import -m 'import for git-svn' . '$svnrepo' &&
 	cd ..
 	"
 
 test_expect_success 'mirror via git-svn' "
-	git-svn init $svnrepo &&
+	git-svn init '$svnrepo' &&
 	git-svn fetch &&
 	git checkout -f -b test-rmdir remotes/git-svn
 	"
@@ -23,7 +23,7 @@ test_expect_success 'Try a commit on rmdir' "
 	git rm -f deeply/nested/directory/number/2/another &&
 	git commit -a -m 'remove another' &&
 	git-svn set-tree --rmdir HEAD &&
-	svn ls -R $svnrepo | grep ^deeply/nested/directory/number/1
+	svn ls -R '$svnrepo' | grep ^deeply/nested/directory/number/1
 	"
 
 
t/t9104-git-svn-follow-parent.sh +25 -25

130 lines not on this page · raw message

t/t9105-git-svn-commit-diff.sh +5 -5
index 318e172..2e1eb75 100755
@@ -8,7 +8,7 @@ test_expect_success 'initialize repo' "
 	mkdir import &&
 	cd import &&
 	echo hello > readme &&
-	svn import -m 'initial' . $svnrepo &&
+	svn import -m 'initial' . '$svnrepo' &&
 	cd .. &&
 	echo hello > readme &&
 	git update-index --add readme &&
@@ -27,16 +27,16 @@ prev=`git rev-parse --verify HEAD^1`
 test_expect_success 'test the commit-diff command' "
 	test -n '$prev' && test -n '$head' &&
 	git-svn commit-diff -r1 '$prev' '$head' '$svnrepo' &&
-	svn co $svnrepo wc &&
+	svn co '$svnrepo' wc &&
 	cmp readme wc/readme
 	"
 
 test_expect_success 'commit-diff to a sub-directory (with git-svn config)' "
-	svn import -m 'sub-directory' import $svnrepo/subdir &&
-	git-svn init --minimize-url $svnrepo/subdir &&
+	svn import -m 'sub-directory' import '$svnrepo/subdir' &&
+	git-svn init --minimize-url '$svnrepo/subdir' &&
 	git-svn fetch &&
 	git-svn commit-diff -r3 '$prev' '$head' &&
-	svn cat $svnrepo/subdir/readme > readme.2 &&
+	svn cat '$svnrepo/subdir/readme' > readme.2 &&
 	cmp readme readme.2
 	"
 
t/t9106-git-svn-commit-diff-clobber.sh +7 -7
index 79b7968..bb42339 100755
@@ -8,14 +8,14 @@ test_expect_success 'initialize repo' "
 	mkdir import &&
 	cd import &&
 	echo initial > file &&
-	svn import -m 'initial' . $svnrepo &&
+	svn import -m 'initial' . '$svnrepo' &&
 	cd .. &&
 	echo initial > file &&
 	git update-index --add file &&
 	git commit -a -m 'initial'
 	"
 test_expect_success 'commit change from svn side' "
-	svn co $svnrepo t.svn &&
+	svn co '$svnrepo' t.svn &&
 	cd t.svn &&
 	echo second line from svn >> file &&
 	poke file &&
@@ -27,7 +27,7 @@ test_expect_success 'commit change from svn side' "
 test_expect_failure 'commit conflicting change from git' "
 	echo second line from git >> file &&
 	git commit -a -m 'second line from git' &&
-	git-svn commit-diff -r1 HEAD~1 HEAD $svnrepo
+	git-svn commit-diff -r1 HEAD~1 HEAD '$svnrepo'
 	" || true
 
 test_expect_success 'commit complementing change from git' "
@@ -36,14 +36,14 @@ test_expect_success 'commit complementing change from git' "
 	git commit -a -m 'second line from svn' &&
 	echo third line from git >> file &&
 	git commit -a -m 'third line from git' &&
-	git-svn commit-diff -r2 HEAD~1 HEAD $svnrepo
+	git-svn commit-diff -r2 HEAD~1 HEAD '$svnrepo'
 	"
 
 test_expect_failure 'dcommit fails to commit because of conflict' "
-	git-svn init $svnrepo &&
+	git-svn init '$svnrepo' &&
 	git-svn fetch &&
 	git reset --hard refs/remotes/git-svn &&
-	svn co $svnrepo t.svn &&
+	svn co '$svnrepo' t.svn &&
 	cd t.svn &&
 	echo fourth line from svn >> file &&
 	poke file &&
@@ -67,7 +67,7 @@ test_expect_success 'dcommit does the svn equivalent of an index merge' "
 	"
 
 test_expect_success 'commit another change from svn side' "
-	svn co $svnrepo t.svn &&
+	svn co '$svnrepo' t.svn &&
 	cd t.svn &&
 		echo third line from svn >> file &&
 		poke file &&
t/t9107-git-svn-migrate.sh +20 -20
index 67fdf70..90bf786 100755
@@ -4,7 +4,7 @@ test_description='git-svn metadata migrations from previous versions'
 . ./lib-git-svn.sh
 
 test_expect_success 'setup old-looking metadata' "
-	cp $GIT_DIR/config $GIT_DIR/config-old-git-svn &&
+	cp '$GIT_DIR/config' '$GIT_DIR/config-old-git-svn' &&
 	mkdir import &&
 	cd import &&
 		for i in trunk branches/a branches/b \
@@ -12,13 +12,13 @@ test_expect_success 'setup old-looking metadata' "
 			mkdir -p \$i && \
 			echo hello >> \$i/README || exit 1
 		done && \
-		svn import -m test . $svnrepo
+		svn import -m test . '$svnrepo'
 		cd .. &&
-	git-svn init $svnrepo &&
+	git-svn init '$svnrepo' &&
 	git-svn fetch &&
-	mv $GIT_DIR/svn/* $GIT_DIR/ &&
-	mv $GIT_DIR/svn/.metadata $GIT_DIR/ &&
-	rmdir $GIT_DIR/svn &&
+	mv '$GIT_DIR'/svn/* '$GIT_DIR/' &&
+	mv '$GIT_DIR/svn/.metadata' '$GIT_DIR/' &&
+	rmdir '$GIT_DIR/svn' &&
 	git update-ref refs/heads/git-svn-HEAD refs/remotes/git-svn &&
 	git update-ref refs/heads/svn-HEAD refs/remotes/git-svn &&
 	git update-ref -d refs/remotes/git-svn refs/remotes/git-svn
@@ -28,20 +28,20 @@ head=`git rev-parse --verify refs/heads/git-svn-HEAD^0`
 test_expect_success 'git-svn-HEAD is a real HEAD' "test -n '$head'"
 
 test_expect_success 'initialize old-style (v0) git-svn layout' "
-	mkdir -p $GIT_DIR/git-svn/info $GIT_DIR/svn/info &&
-	echo $svnrepo > $GIT_DIR/git-svn/info/url &&
-	echo $svnrepo > $GIT_DIR/svn/info/url &&
+	mkdir -p '$GIT_DIR/git-svn/info' '$GIT_DIR/svn/info' &&
+	echo '$svnrepo' > '$GIT_DIR/git-svn/info/url' &&
+	echo '$svnrepo' > '$GIT_DIR/svn/info/url' &&
 	git-svn migrate &&
-	! test -d $GIT_DIR/git-svn &&
+	! test -d '$GIT_DIR/git-svn' &&
 	git rev-parse --verify refs/remotes/git-svn^0 &&
 	git rev-parse --verify refs/remotes/svn^0 &&
-	test \`git config --get svn-remote.svn.url\` = '$svnrepo' &&
+	test \"\`git config --get svn-remote.svn.url\`\" = \"$svnrepo\" &&
 	test \`git config --get svn-remote.svn.fetch\` = \
              ':refs/remotes/git-svn'
 	"
 
 test_expect_success 'initialize a multi-repository repo' "
-	git-svn init $svnrepo -T trunk -t tags -b branches &&
+	git-svn init '$svnrepo' -T trunk -t tags -b branches &&
 	git config --get-all svn-remote.svn.fetch > fetch.out &&
 	grep '^trunk:refs/remotes/trunk$' fetch.out &&
 	test -n \"\`git config --get svn-remote.svn.branches \
@@ -76,14 +76,14 @@ test_expect_success 'multi-fetch works on partial urls + paths' "
 test_expect_success 'migrate --minimize on old inited layout' "
 	git config --unset-all svn-remote.svn.fetch &&
 	git config --unset-all svn-remote.svn.url &&
-	rm -rf $GIT_DIR/svn &&
+	rm -rf '$GIT_DIR/svn' &&
 	for i in \`cat fetch.out\`; do
 		path=\`expr \$i : '\\([^:]*\\):.*$'\`
 		ref=\`expr \$i : '[^:]*:refs/remotes/\\(.*\\)$'\`
 		if test -z \"\$ref\"; then continue; fi
 		if test -n \"\$path\"; then path=\"/\$path\"; fi
-		( mkdir -p $GIT_DIR/svn/\$ref/info/ &&
-		echo $svnrepo\$path > $GIT_DIR/svn/\$ref/info/url ) || exit 1;
+		( mkdir -p '$GIT_DIR'/svn/\$ref/info/ &&
+		echo '$svnrepo'\$path > '$GIT_DIR'/svn/\$ref/info/url ) || exit 1;
 	done &&
 	git-svn migrate --minimize &&
 	test -z \"\`git config -l |grep -v '^svn-remote\.git-svn\.'\`\" &&
@@ -99,13 +99,13 @@ test_expect_success 'migrate --minimize on old inited layout' "
 
 test_expect_success  ".rev_db auto-converted to .rev_db.UUID" "
 	git-svn fetch -i trunk &&
-	expect=$GIT_DIR/svn/trunk/.rev_db.* &&
+	expect=\"\`find \"\$GIT_DIR\"/svn/trunk/ -name '.rev_db.*'\`\" &&
 	test -n \"\$expect\" &&
-	mv \$expect $GIT_DIR/svn/trunk/.rev_db &&
+	mv \"\$expect\" \"\$GIT_DIR\"/svn/trunk/.rev_db &&
 	git-svn fetch -i trunk &&
-	test -L $GIT_DIR/svn/trunk/.rev_db &&
-	test -f \$expect &&
-	cmp \$expect $GIT_DIR/svn/trunk/.rev_db
+	test -L \"\$GIT_DIR\"/svn/trunk/.rev_db &&
+	test -f \"\$expect\" &&
+	cmp \"\$expect\" \"\$GIT_DIR\"/svn/trunk/.rev_db
 	"
 
 test_done
t/t9108-git-svn-glob.sh +4 -4
index db4344c..c6dc0ef 100755
@@ -14,8 +14,8 @@ test_expect_success 'test refspec globbing' "
 	mkdir -p trunk/src/a trunk/src/b trunk/doc &&
 	echo 'hello world' > trunk/src/a/readme &&
 	echo 'goodbye world' > trunk/src/b/readme &&
-	svn import -m 'initial' trunk $svnrepo/trunk &&
-	svn co $svnrepo tmp &&
+	svn import -m 'initial' trunk '$svnrepo/trunk' &&
+	svn co '$svnrepo' tmp &&
 	cd tmp &&
 		mkdir branches tags &&
 		svn add branches tags &&
@@ -38,7 +38,7 @@ test_expect_success 'test refspec globbing' "
 		poke tags/end/src/b/readme &&
 		svn commit -m 'nothing to see here'
 		cd .. &&
-	git config --add svn-remote.svn.url $svnrepo &&
+	git config --add svn-remote.svn.url '$svnrepo' &&
 	git config --add svn-remote.svn.fetch \
 	                 'trunk/src/a:refs/remotes/trunk' &&
 	git config --add svn-remote.svn.branches \
@@ -60,7 +60,7 @@ echo nothing to see here >> expect.two
 cat expect.end >> expect.two
 
 test_expect_success 'test left-hand-side only globbing' "
-	git config --add svn-remote.two.url $svnrepo &&
+	git config --add svn-remote.two.url '$svnrepo' &&
 	git config --add svn-remote.two.fetch trunk:refs/remotes/two/trunk &&
 	git config --add svn-remote.two.branches \
 	                 'branches/*:refs/remotes/two/branches/*' &&
t/t9110-git-svn-use-svm-props.sh +4 -4
index 6235af4..d4ab01f 100755
@@ -8,11 +8,11 @@ test_description='git-svn useSvmProps test'
 . ./lib-git-svn.sh
 
 test_expect_success 'load svm repo' "
-	svnadmin load -q $rawsvnrepo < ../t9110/svm.dump &&
-	git-svn init --minimize-url -R arr -i bar $svnrepo/mirror/arr &&
-	git-svn init --minimize-url -R argh -i dir $svnrepo/mirror/argh &&
+	svnadmin load -q '$rawsvnrepo' < ../t9110/svm.dump &&
+	git-svn init --minimize-url -R arr -i bar '$svnrepo/mirror/arr' &&
+	git-svn init --minimize-url -R argh -i dir '$svnrepo/mirror/argh' &&
 	git-svn init --minimize-url -R argh -i e \
-	  $svnrepo/mirror/argh/a/b/c/d/e &&
+	  '$svnrepo/mirror/argh/a/b/c/d/e' &&
 	git config svn.useSvmProps true &&
 	git-svn fetch --all
 	"
t/t9111-git-svn-use-svnsync-props.sh +4 -4
index ec7dedd..936f023 100755
@@ -8,10 +8,10 @@ test_description='git-svn useSvnsyncProps test'
 . ./lib-git-svn.sh
 
 test_expect_success 'load svnsync repo' "
-	svnadmin load -q $rawsvnrepo < ../t9111/svnsync.dump &&
-	git-svn init --minimize-url -R arr -i bar $svnrepo/bar &&
-	git-svn init --minimize-url -R argh -i dir $svnrepo/dir &&
-	git-svn init --minimize-url -R argh -i e $svnrepo/dir/a/b/c/d/e &&
+	svnadmin load -q '$rawsvnrepo' < ../t9111/svnsync.dump &&
+	git-svn init --minimize-url -R arr -i bar '$svnrepo/bar' &&
+	git-svn init --minimize-url -R argh -i dir '$svnrepo/dir' &&
+	git-svn init --minimize-url -R argh -i e '$svnrepo/dir/a/b/c/d/e' &&
 	git config svn.useSvnsyncProps true &&
 	git-svn fetch --all
 	"
t/t9112-git-svn-md5less-file.sh +2 -2
index 08313bb..b095583 100755
@@ -38,8 +38,8 @@ PROPS-END
 
 EOF
 
-test_expect_success 'load svn dumpfile' "svnadmin load $rawsvnrepo < dumpfile.svn"
+test_expect_success 'load svn dumpfile' "svnadmin load '$rawsvnrepo' < dumpfile.svn"
 
-test_expect_success 'initialize git-svn' "git-svn init $svnrepo"
+test_expect_success 'initialize git-svn' "git-svn init '$svnrepo'"
 test_expect_success 'fetch revisions from svn' 'git-svn fetch'
 test_done
t/t9113-git-svn-dcommit-new-file.sh +3 -3
index 9ef0db9..0088c75 100755
@@ -15,14 +15,14 @@ test_description='git-svn dcommit new files over svn:// test'
 
 start_svnserve () {
 	svnserve --listen-port $SVNSERVE_PORT \
-	         --root $rawsvnrepo \
+	         --root '$rawsvnrepo' \
 	         --listen-once \
 	         --listen-host 127.0.0.1 &
 }
 
 test_expect_success 'start tracking an empty repo' "
-	svn mkdir -m 'empty dir' $svnrepo/empty-dir &&
-	echo anon-access = write >> $rawsvnrepo/conf/svnserve.conf &&
+	svn mkdir -m 'empty dir' '$svnrepo/empty-dir' &&
+	echo anon-access = write >> '$rawsvnrepo/conf/svnserve.conf' &&
 	start_svnserve &&
 	git svn init svn://127.0.0.1:$SVNSERVE_PORT &&
 	git svn fetch
t/t9114-git-svn-dcommit-merge.sh +2 -2
index d6ca955..64ec7fd 100755
@@ -35,7 +35,7 @@ EOF
 }
 
 test_expect_success 'setup svn repository' "
-	svn co $svnrepo mysvnwork &&
+	svn co '$svnrepo' mysvnwork &&
 	mkdir -p mysvnwork/trunk &&
 	cd mysvnwork &&
 		big_text_block >> trunk/README &&
@@ -45,7 +45,7 @@ test_expect_success 'setup svn repository' "
 	"
 
 test_expect_success 'setup git mirror and merge' "
-	git svn init $svnrepo -t tags -T trunk -b branches &&
+	git svn init '$svnrepo' -t tags -T trunk -b branches &&
 	git svn fetch &&
 	git checkout --track -b svn remotes/trunk &&
 	git checkout -b merge &&
t/t9115-git-svn-dcommit-funky-renames.sh +2 -2
index 182299c..653578d 100755
@@ -8,12 +8,12 @@ test_description='git-svn dcommit can commit renames of files with ugly names'
 . ./lib-git-svn.sh
 
 test_expect_success 'load repository with strange names' "
-	svnadmin load -q $rawsvnrepo < ../t9115/funky-names.dump &&
+	svnadmin load -q '$rawsvnrepo' < ../t9115/funky-names.dump &&
 	start_httpd
 	"
 
 test_expect_success 'init and fetch repository' "
-	git svn init $svnrepo &&
+	git svn init '$svnrepo' &&
 	git svn fetch &&
 	git reset --hard git-svn
 	"
t/t9116-git-svn-log.sh +2 -2
index 0d4e6b3..70c0c5f 100755
@@ -14,9 +14,9 @@ test_expect_success 'setup repository and import' "
 			mkdir -p \$i && \
 			echo hello >> \$i/README || exit 1
 		done && \
-		svn import -m test . $svnrepo
+		svn import -m test . '$svnrepo'
 		cd .. &&
-	git-svn init $svnrepo -T trunk -b branches -t tags &&
+	git-svn init '$svnrepo' -T trunk -b branches -t tags &&
 	git-svn fetch &&
 	git reset --hard trunk &&
 	echo bye >> README &&
t/t9500-gitweb-standalone-no-errors.sh +2 -2
index 642b836..b90e78c 100755
@@ -45,13 +45,13 @@ gitweb_run () {
 	export QUERY_STRING=""$1""
 	export PATH_INFO=""$2""
 
-	export GITWEB_CONFIG=$(pwd)/gitweb_config.perl
+	export GITWEB_CONFIG="$(pwd)/gitweb_config.perl"
 
 	# some of git commands write to STDERR on error, but this is not
 	# written to web server logs, so we are not interested in that:
 	# we are interested only in properly formatted errors/warnings
 	rm -f gitweb.log &&
-	perl -- $(pwd)/../../gitweb/gitweb.perl \
+	perl -- "$(pwd)/../../gitweb/gitweb.perl" \
 		>/dev/null 2>gitweb.log &&
 	if grep -q -s "^[[]" gitweb.log >/dev/null; then false; else true; fi
 
t/test-lib.sh +1 -1
index cc1253c..a68415f 100644
@@ -229,7 +229,7 @@ test_create_repo () {
 	repo="$1"
 	mkdir "$repo"
 	cd "$repo" || error "Cannot setup test environment"
-	"$GIT_EXEC_PATH/git" init --template=$GIT_EXEC_PATH/templates/blt/ >/dev/null 2>&1 ||
+	"$GIT_EXEC_PATH/git" init --template="$GIT_EXEC_PATH/templates/blt/" >/dev/null 2>&1 ||
 	error "cannot run git init -- have you built things yet?"
 	mv .git/hooks .git/hooks-disabled
 	cd "$owd"
Signature · 1 line
1.5.3.1
#32 lore raw

Re: [PATCH 2/3] Quoting paths in tests

t/t9100-git-svn-basic.sh test_expect_success \ · line 37

Quoted 6 lines · Jonathan del Strother
t/t9100-git-svn-basic.sh +2 -2
-	svn import -m 'import for git-svn' . $svnrepo >/dev/null &&
+	svn import -m 'import for git-svn' . '$svnrepo' >/dev/null &&
 	cd .. &&
 	rm -rf import &&
-	git-svn init $svnrepo"
+	git-svn init '$svnrepo'"

I don't see the point in changing an incorrect quoting to a different incorrect quoting that you fix up in a follow-up patch. It's *two* large patches to review instead of just one. I'm stopping the review here.

-- Hannes

#33 lore raw

Re: [PATCH 2/3] Quoting paths in tests

Quoted 12 lines · Johannes Sixt

t/t9100-git-svn-basic.sh test_expect_success \ · line 37

Quoted 6 lines · Jonathan del Strother
t/t9100-git-svn-basic.sh +2 -2
-	svn import -m 'import for git-svn' . $svnrepo >/dev/null &&
+	svn import -m 'import for git-svn' . '$svnrepo' >/dev/null &&
 	cd .. &&
 	rm -rf import &&
-	git-svn init $svnrepo"
+	git-svn init '$svnrepo'"

I don't see the point in changing an incorrect quoting to a different incorrect quoting that you fix up in a follow-up patch. It's *two* large patches to review instead of just one. I'm stopping the review here.

Since I consider it unlikely that Jonathan is making your life harder on purpose, it might be somewhat more helpful to offer submission advice:

Jonathan, try

git rebase -i HEAD~3

or so in order to consolidate the last 3 patches you did. Interactive rebase is one useful manner of munging history until it looks reasonably nice for submission. One major point of git's distributed operation is that one can clean up the development history locally before handing things out.

That makes the project repositories cleaner to understand.

Signature · 1 line
David Kastrup
#34 lore raw

Re: [PATCH 2/3] Quoting paths in tests

In reply to Johannes Sixt
Quoted 9 lines · Johannes Sixt

t/t9100-git-svn-basic.sh test_expect_success \ · line 37

Quoted 6 lines · Jonathan del Strother
t/t9100-git-svn-basic.sh +1 -1
-	svn import -m 'import for git-svn' . $svnrepo >/dev/null &&
+	svn import -m 'import for git-svn' . '$svnrepo' >/dev/null &&
	cd .. &&
	rm -rf import &&
t/t9100-git-svn-basic.sh +1 -1
-	git-svn init $svnrepo"
+	git-svn init '$svnrepo'"

I don't see the point in changing an incorrect quoting to a different incorrect quoting that you fix up in a follow-up patch. It's *two* large patches to review instead of just one. I'm stopping the review here.

If we want to support apostrophed paths in tests, I'll flatten 2 & 3 into a single patch. I thought I'd make the apostrophe part optional since there seemed to be some resistance to having to bother about quoting & escaping in tests..

#35 lore raw

Re: [PATCH 2/3] Quoting paths in tests

Quoted 4 lines · Jonathan del Strother
Quoted 1 line · Johannes Sixt

I don't see the point in changing an incorrect quoting to a different incorrect quoting that you fix up in a follow-up patch. It's *two* large patches to review instead of just one. I'm stopping the review here.

If we want to support apostrophed paths in tests,

I could ask, "if we want to support paths with blanks in tests", so...

Quoted 1 line

I'll flatten 2 & 3 into a single patch. I thought I'd make the apostrophe part optional since there seemed to be some resistance to having to bother about quoting & escaping in tests..

You could also make a patch that reverses the quoting in t9100-* (and probably others), i.e. instead of

	"... '$foo'..." (which is incorrect)
or
	"... \"$foo\"..."
make it
	'... "$foo" ...'

It will be a large patch, too, but the result should be easier to read.

-- Hannes

#36 lore raw

PATCH 3/3 Fix apostrophe quoting in tests

In reply to Andreas Ericsson

From: Jonathan del Strother <[email protected]>

Double-quoting all paths so the tests can be run from inside a directory named "Joe's git"

---
 t/t9100-git-svn-basic.sh                 |   54 +++++++++++++++---------------
 t/t9101-git-svn-props.sh                 |    6 ++--
 t/t9102-git-svn-deep-rmdir.sh            |    6 ++--
 t/t9104-git-svn-follow-parent.sh         |   50 ++++++++++++++--------------
 t/t9105-git-svn-commit-diff.sh           |   12 +++---
 t/t9106-git-svn-commit-diff-clobber.sh   |   14 ++++----
 t/t9107-git-svn-migrate.sh               |   28 ++++++++--------
 t/t9108-git-svn-glob.sh                  |    8 ++--
 t/t9110-git-svn-use-svm-props.sh         |    8 ++--
 t/t9111-git-svn-use-svnsync-props.sh     |    8 ++--
 t/t9112-git-svn-md5less-file.sh          |    4 +-
 t/t9113-git-svn-dcommit-new-file.sh      |    6 ++--
 t/t9114-git-svn-dcommit-merge.sh         |    4 +-
 t/t9115-git-svn-dcommit-funky-renames.sh |    4 +-
 t/t9116-git-svn-log.sh                   |    4 +-
 15 files changed, 108 insertions(+), 108 deletions(-)
t/t9100-git-svn-basic.sh +27 -27
index c3585da..1d802a8 100755
@@ -31,16 +31,16 @@ test_expect_success \
 	echo 'zzz' > bar/zzz &&
 	echo '#!/bin/sh' > exec.sh &&
 	chmod +x exec.sh &&
-	svn import -m 'import for git-svn' . '$svnrepo' >/dev/null &&
+	svn import -m 'import for git-svn' . \"$svnrepo\" >/dev/null &&
 	cd .. &&
 	rm -rf import &&
-	git-svn init '$svnrepo'"
+	git-svn init \"$svnrepo\""
 
 test_expect_success \
     'import an SVN revision into git' \
     'git-svn fetch'
 
-test_expect_success "checkout from svn" "svn co '$svnrepo' '$SVN_TREE'"
+test_expect_success "checkout from svn" "svn co \"$svnrepo\" \"$SVN_TREE\""
 
 name='try a deep --rmdir with a commit'
 test_expect_success "$name" "
@@ -51,8 +51,8 @@ test_expect_success "$name" "
 	git commit -m '$name' &&
 	git-svn set-tree --find-copies-harder --rmdir \
 		remotes/git-svn..mybranch &&
-	svn up '$SVN_TREE' &&
-	test -d '$SVN_TREE'/dir && test ! -d '$SVN_TREE'/dir/a"
+	svn up \"$SVN_TREE\" &&
+	test -d \"$SVN_TREE\"/dir && test ! -d \"$SVN_TREE\"/dir/a"
 
 
 name='detect node change from file to directory #1'
@@ -69,7 +69,7 @@ test_expect_failure "$name" "
 
 name='detect node change from directory to file #1'
 test_expect_failure "$name" "
-	rm -rf dir '$GIT_DIR'/index &&
+	rm -rf dir \"$GIT_DIR\"/index &&
 	git checkout -f -b mybranch2 remotes/git-svn &&
 	mv bar/zzz zzz &&
 	rm -rf bar &&
@@ -83,7 +83,7 @@ test_expect_failure "$name" "
 
 name='detect node change from file to directory #2'
 test_expect_failure "$name" "
-	rm -f '$GIT_DIR'/index &&
+	rm -f \"$GIT_DIR\"/index &&
 	git checkout -f -b mybranch3 remotes/git-svn &&
 	rm bar/zzz &&
 	git update-index --remove bar/zzz &&
@@ -97,7 +97,7 @@ test_expect_failure "$name" "
 
 name='detect node change from directory to file #2'
 test_expect_failure "$name" "
-	rm -f '$GIT_DIR'/index &&
+	rm -f \"$GIT_DIR\"/index &&
 	git checkout -f -b mybranch4 remotes/git-svn &&
 	rm -rf dir &&
 	git update-index --remove -- dir/file &&
@@ -111,15 +111,15 @@ test_expect_failure "$name" "
 
 name='remove executable bit from a file'
 test_expect_success "$name" "
-	rm -f '$GIT_DIR'/index &&
+	rm -f \"$GIT_DIR\"/index &&
 	git checkout -f -b mybranch5 remotes/git-svn &&
 	chmod -x exec.sh &&
 	git update-index exec.sh &&
 	git commit -m '$name' &&
 	git-svn set-tree --find-copies-harder --rmdir \
 		remotes/git-svn..mybranch5 &&
-	svn up '$SVN_TREE' &&
-	test ! -x '$SVN_TREE'/exec.sh"
+	svn up \"$SVN_TREE\" &&
+	test ! -x \"$SVN_TREE\"/exec.sh"
 
 
 name='add executable bit back file'
@@ -129,8 +129,8 @@ test_expect_success "$name" "
 	git commit -m '$name' &&
 	git-svn set-tree --find-copies-harder --rmdir \
 		remotes/git-svn..mybranch5 &&
-	svn up '$SVN_TREE' &&
-	test -x '$SVN_TREE'/exec.sh"
+	svn up \"$SVN_TREE\" &&
+	test -x \"$SVN_TREE\"/exec.sh"
 
 
 name='executable file becomes a symlink to bar/zzz (file)'
@@ -141,8 +141,8 @@ test_expect_success "$name" "
 	git commit -m '$name' &&
 	git-svn set-tree --find-copies-harder --rmdir \
 		remotes/git-svn..mybranch5 &&
-	svn up '$SVN_TREE' &&
-	test -L '$SVN_TREE'/exec.sh"
+	svn up \"$SVN_TREE\" &&
+	test -L \"$SVN_TREE\"/exec.sh"
 
 name='new symlink is added to a file that was also just made executable'
 
@@ -153,9 +153,9 @@ test_expect_success "$name" "
 	git commit -m '$name' &&
 	git-svn set-tree --find-copies-harder --rmdir \
 		remotes/git-svn..mybranch5 &&
-	svn up '$SVN_TREE' &&
-	test -x '$SVN_TREE'/bar/zzz &&
-	test -L '$SVN_TREE'/exec-2.sh"
+	svn up \"$SVN_TREE\" &&
+	test -x \"$SVN_TREE\"/bar/zzz &&
+	test -L \"$SVN_TREE\"/exec-2.sh"
 
 name='modify a symlink to become a file'
 test_expect_success "$name" "
@@ -166,10 +166,10 @@ test_expect_success "$name" "
 	git commit -m '$name' &&
 	git-svn set-tree --find-copies-harder --rmdir \
 		remotes/git-svn..mybranch5 &&
-	svn up '$SVN_TREE' &&
-	test -f '$SVN_TREE'/exec-2.sh &&
-	test ! -L '$SVN_TREE'/exec-2.sh &&
-	git diff help '$SVN_TREE/exec-2.sh'"
+	svn up \"$SVN_TREE\" &&
+	test -f \"$SVN_TREE\"/exec-2.sh &&
+	test ! -L \"$SVN_TREE\"/exec-2.sh &&
+	git diff help \"$SVN_TREE\"/exec-2.sh"
 
 if test "$have_utf8" = t
 then
@@ -190,7 +190,7 @@ name='test fetch functionality (svn => git) with alternate GIT_SVN_ID'
 GIT_SVN_ID=alt
 export GIT_SVN_ID
 test_expect_success "$name" \
-    "git-svn init '$svnrepo' && git-svn fetch &&
+    "git-svn init \"$svnrepo\" && git-svn fetch &&
      git rev-list --pretty=raw remotes/git-svn | grep ^tree | uniq > a &&
      git rev-list --pretty=raw remotes/alt | grep ^tree | uniq > b &&
      git diff a b"
@@ -220,16 +220,16 @@ test_expect_failure 'exit if remote refs are ambigious' "
         "
 
 test_expect_failure 'exit if init-ing a would clobber a URL' "
-        svnadmin create '${PWD}/svnrepo2' &&
-        svn mkdir -m 'mkdir bar' '${svnrepo}2/bar' &&
+        svnadmin create \"${PWD}/svnrepo2\" &&
+        svn mkdir -m 'mkdir bar' \"${svnrepo}2/bar\" &&
         git config --unset svn-remote.svn.fetch \
                                 '^bar:refs/remotes/git-svn$' &&
-        git-svn init '${svnrepo}2/bar'
+        git-svn init \"${svnrepo}2/bar\"
         "
 
 test_expect_success \
   'init allows us to connect to another directory in the same repo' "
-        git-svn init --minimize-url -i bar '$svnrepo/bar' &&
+        git-svn init --minimize-url -i bar \"$svnrepo/bar\" &&
         git config --get svn-remote.svn.fetch \
                               '^bar:refs/remotes/bar$' &&
         git config --get svn-remote.svn.fetch \
t/t9101-git-svn-props.sh +3 -3
index a1c85e0..e741bfe 100755
@@ -52,7 +52,7 @@ EOF
 cd ..
 
 rm -rf import
-test_expect_success 'checkout working copy from svn' "svn co '$svnrepo' test_wc"
+test_expect_success 'checkout working copy from svn' "svn co \"$svnrepo\" test_wc"
 test_expect_success 'setup some commits to svn' \
 	'cd test_wc &&
 		echo Greetings >> kw.c &&
@@ -66,7 +66,7 @@ test_expect_success 'setup some commits to svn' \
 		svn commit -m "Propset Id" &&
 	cd ..'
 
-test_expect_success 'initialize git-svn' "git-svn init '$svnrepo'"
+test_expect_success 'initialize git-svn' "git-svn init \"$svnrepo\""
 test_expect_success 'fetch revisions from svn' 'git-svn fetch'
 
 name='test svn:keywords ignoring'
@@ -92,7 +92,7 @@ test_expect_success "propset CR on crlf files" \
 test_expect_success 'fetch and pull latest from svn and checkout a new wc' \
 	"git-svn fetch &&
 	 git pull . remotes/git-svn &&
-	 svn co '$svnrepo' new_wc"
+	 svn co \"$svnrepo\" new_wc"
 
 for i in crlf ne_crlf lf ne_lf cr ne_cr empty_cr empty_lf empty empty_crlf
 do
t/t9102-git-svn-deep-rmdir.sh +3 -3
index 99c8840..e3af319 100755
@@ -9,12 +9,12 @@ test_expect_success 'initialize repo' "
 	mkdir -p deeply/nested/directory/number/2 &&
 	echo foo > deeply/nested/directory/number/1/file &&
 	echo foo > deeply/nested/directory/number/2/another &&
-	svn import -m 'import for git-svn' . '$svnrepo' &&
+	svn import -m 'import for git-svn' . \"$svnrepo\" &&
 	cd ..
 	"
 
 test_expect_success 'mirror via git-svn' "
-	git-svn init '$svnrepo' &&
+	git-svn init \"$svnrepo\" &&
 	git-svn fetch &&
 	git checkout -f -b test-rmdir remotes/git-svn
 	"
@@ -23,7 +23,7 @@ test_expect_success 'Try a commit on rmdir' "
 	git rm -f deeply/nested/directory/number/2/another &&
 	git commit -a -m 'remove another' &&
 	git-svn set-tree --rmdir HEAD &&
-	svn ls -R '$svnrepo' | grep ^deeply/nested/directory/number/1
+	svn ls -R \"$svnrepo\" | grep ^deeply/nested/directory/number/1
 	"
 
 
t/t9104-git-svn-follow-parent.sh +25 -25

130 lines not on this page · raw message

t/t9105-git-svn-commit-diff.sh +6 -6
index 2e1eb75..9cc38d3 100755
@@ -8,7 +8,7 @@ test_expect_success 'initialize repo' "
 	mkdir import &&
 	cd import &&
 	echo hello > readme &&
-	svn import -m 'initial' . '$svnrepo' &&
+	svn import -m 'initial' . \"$svnrepo\" &&
 	cd .. &&
 	echo hello > readme &&
 	git update-index --add readme &&
@@ -26,17 +26,17 @@ prev=`git rev-parse --verify HEAD^1`
 
 test_expect_success 'test the commit-diff command' "
 	test -n '$prev' && test -n '$head' &&
-	git-svn commit-diff -r1 '$prev' '$head' '$svnrepo' &&
-	svn co '$svnrepo' wc &&
+	git-svn commit-diff -r1 '$prev' '$head' \"$svnrepo\" &&
+	svn co \"$svnrepo\" wc &&
 	cmp readme wc/readme
 	"
 
 test_expect_success 'commit-diff to a sub-directory (with git-svn config)' "
-	svn import -m 'sub-directory' import '$svnrepo/subdir' &&
-	git-svn init --minimize-url '$svnrepo/subdir' &&
+	svn import -m 'sub-directory' import \"$svnrepo/subdir\" &&
+	git-svn init --minimize-url \"$svnrepo/subdir\" &&
 	git-svn fetch &&
 	git-svn commit-diff -r3 '$prev' '$head' &&
-	svn cat '$svnrepo/subdir/readme' > readme.2 &&
+	svn cat \"$svnrepo/subdir/readme\" > readme.2 &&
 	cmp readme readme.2
 	"
 
t/t9106-git-svn-commit-diff-clobber.sh +7 -7
index bb42339..892ca55 100755
@@ -8,14 +8,14 @@ test_expect_success 'initialize repo' "
 	mkdir import &&
 	cd import &&
 	echo initial > file &&
-	svn import -m 'initial' . '$svnrepo' &&
+	svn import -m 'initial' . \"$svnrepo\" &&
 	cd .. &&
 	echo initial > file &&
 	git update-index --add file &&
 	git commit -a -m 'initial'
 	"
 test_expect_success 'commit change from svn side' "
-	svn co '$svnrepo' t.svn &&
+	svn co \"$svnrepo\" t.svn &&
 	cd t.svn &&
 	echo second line from svn >> file &&
 	poke file &&
@@ -27,7 +27,7 @@ test_expect_success 'commit change from svn side' "
 test_expect_failure 'commit conflicting change from git' "
 	echo second line from git >> file &&
 	git commit -a -m 'second line from git' &&
-	git-svn commit-diff -r1 HEAD~1 HEAD '$svnrepo'
+	git-svn commit-diff -r1 HEAD~1 HEAD \"$svnrepo\"
 	" || true
 
 test_expect_success 'commit complementing change from git' "
@@ -36,14 +36,14 @@ test_expect_success 'commit complementing change from git' "
 	git commit -a -m 'second line from svn' &&
 	echo third line from git >> file &&
 	git commit -a -m 'third line from git' &&
-	git-svn commit-diff -r2 HEAD~1 HEAD '$svnrepo'
+	git-svn commit-diff -r2 HEAD~1 HEAD \"$svnrepo\"
 	"
 
 test_expect_failure 'dcommit fails to commit because of conflict' "
-	git-svn init '$svnrepo' &&
+	git-svn init \"$svnrepo\" &&
 	git-svn fetch &&
 	git reset --hard refs/remotes/git-svn &&
-	svn co '$svnrepo' t.svn &&
+	svn co \"$svnrepo\" t.svn &&
 	cd t.svn &&
 	echo fourth line from svn >> file &&
 	poke file &&
@@ -67,7 +67,7 @@ test_expect_success 'dcommit does the svn equivalent of an index merge' "
 	"
 
 test_expect_success 'commit another change from svn side' "
-	svn co '$svnrepo' t.svn &&
+	svn co \"$svnrepo\" t.svn &&
 	cd t.svn &&
 		echo third line from svn >> file &&
 		poke file &&
t/t9107-git-svn-migrate.sh +14 -14
index 90bf786..59e8f0d 100755
@@ -4,7 +4,7 @@ test_description='git-svn metadata migrations from previous versions'
 . ./lib-git-svn.sh
 
 test_expect_success 'setup old-looking metadata' "
-	cp '$GIT_DIR/config' '$GIT_DIR/config-old-git-svn' &&
+	cp \"$GIT_DIR/config\" \"$GIT_DIR/config-old-git-svn\" &&
 	mkdir import &&
 	cd import &&
 		for i in trunk branches/a branches/b \
@@ -12,13 +12,13 @@ test_expect_success 'setup old-looking metadata' "
 			mkdir -p \$i && \
 			echo hello >> \$i/README || exit 1
 		done && \
-		svn import -m test . '$svnrepo'
+		svn import -m test . \"$svnrepo\"
 		cd .. &&
-	git-svn init '$svnrepo' &&
+	git-svn init \"$svnrepo\" &&
 	git-svn fetch &&
-	mv '$GIT_DIR'/svn/* '$GIT_DIR/' &&
-	mv '$GIT_DIR/svn/.metadata' '$GIT_DIR/' &&
-	rmdir '$GIT_DIR/svn' &&
+	mv \"$GIT_DIR\"/svn/* \"$GIT_DIR/\" &&
+	mv \"$GIT_DIR/svn/.metadata\" \"$GIT_DIR/\" &&
+	rmdir \"$GIT_DIR/svn\" &&
 	git update-ref refs/heads/git-svn-HEAD refs/remotes/git-svn &&
 	git update-ref refs/heads/svn-HEAD refs/remotes/git-svn &&
 	git update-ref -d refs/remotes/git-svn refs/remotes/git-svn
@@ -28,11 +28,11 @@ head=`git rev-parse --verify refs/heads/git-svn-HEAD^0`
 test_expect_success 'git-svn-HEAD is a real HEAD' "test -n '$head'"
 
 test_expect_success 'initialize old-style (v0) git-svn layout' "
-	mkdir -p '$GIT_DIR/git-svn/info' '$GIT_DIR/svn/info' &&
-	echo '$svnrepo' > '$GIT_DIR/git-svn/info/url' &&
-	echo '$svnrepo' > '$GIT_DIR/svn/info/url' &&
+	mkdir -p \"$GIT_DIR/git-svn/info\" \"$GIT_DIR/svn/info\" &&
+	echo \"$svnrepo\" > \"$GIT_DIR/git-svn/info/url\" &&
+	echo \"$svnrepo\" > \"$GIT_DIR/svn/info/url\" &&
 	git-svn migrate &&
-	! test -d '$GIT_DIR/git-svn' &&
+	! test -d \"$GIT_DIR/git-svn\" &&
 	git rev-parse --verify refs/remotes/git-svn^0 &&
 	git rev-parse --verify refs/remotes/svn^0 &&
 	test \"\`git config --get svn-remote.svn.url\`\" = \"$svnrepo\" &&
@@ -41,7 +41,7 @@ test_expect_success 'initialize old-style (v0) git-svn layout' "
 	"
 
 test_expect_success 'initialize a multi-repository repo' "
-	git-svn init '$svnrepo' -T trunk -t tags -b branches &&
+	git-svn init \"$svnrepo\" -T trunk -t tags -b branches &&
 	git config --get-all svn-remote.svn.fetch > fetch.out &&
 	grep '^trunk:refs/remotes/trunk$' fetch.out &&
 	test -n \"\`git config --get svn-remote.svn.branches \
@@ -76,14 +76,14 @@ test_expect_success 'multi-fetch works on partial urls + paths' "
 test_expect_success 'migrate --minimize on old inited layout' "
 	git config --unset-all svn-remote.svn.fetch &&
 	git config --unset-all svn-remote.svn.url &&
-	rm -rf '$GIT_DIR/svn' &&
+	rm -rf \"$GIT_DIR/svn\" &&
 	for i in \`cat fetch.out\`; do
 		path=\`expr \$i : '\\([^:]*\\):.*$'\`
 		ref=\`expr \$i : '[^:]*:refs/remotes/\\(.*\\)$'\`
 		if test -z \"\$ref\"; then continue; fi
 		if test -n \"\$path\"; then path=\"/\$path\"; fi
-		( mkdir -p '$GIT_DIR'/svn/\$ref/info/ &&
-		echo '$svnrepo'\$path > '$GIT_DIR'/svn/\$ref/info/url ) || exit 1;
+		( mkdir -p \"$GIT_DIR\"/svn/\$ref/info/ &&
+		echo \"$svnrepo\"\$path > \"$GIT_DIR\"/svn/\$ref/info/url ) || exit 1;
 	done &&
 	git-svn migrate --minimize &&
 	test -z \"\`git config -l |grep -v '^svn-remote\.git-svn\.'\`\" &&
t/t9108-git-svn-glob.sh +4 -4
index c6dc0ef..eb039ef 100755
@@ -14,8 +14,8 @@ test_expect_success 'test refspec globbing' "
 	mkdir -p trunk/src/a trunk/src/b trunk/doc &&
 	echo 'hello world' > trunk/src/a/readme &&
 	echo 'goodbye world' > trunk/src/b/readme &&
-	svn import -m 'initial' trunk '$svnrepo/trunk' &&
-	svn co '$svnrepo' tmp &&
+	svn import -m 'initial' trunk \"$svnrepo/trunk\" &&
+	svn co \"$svnrepo\" tmp &&
 	cd tmp &&
 		mkdir branches tags &&
 		svn add branches tags &&
@@ -38,7 +38,7 @@ test_expect_success 'test refspec globbing' "
 		poke tags/end/src/b/readme &&
 		svn commit -m 'nothing to see here'
 		cd .. &&
-	git config --add svn-remote.svn.url '$svnrepo' &&
+	git config --add svn-remote.svn.url \"$svnrepo\" &&
 	git config --add svn-remote.svn.fetch \
 	                 'trunk/src/a:refs/remotes/trunk' &&
 	git config --add svn-remote.svn.branches \
@@ -60,7 +60,7 @@ echo nothing to see here >> expect.two
 cat expect.end >> expect.two
 
 test_expect_success 'test left-hand-side only globbing' "
-	git config --add svn-remote.two.url '$svnrepo' &&
+	git config --add svn-remote.two.url \"$svnrepo\" &&
 	git config --add svn-remote.two.fetch trunk:refs/remotes/two/trunk &&
 	git config --add svn-remote.two.branches \
 	                 'branches/*:refs/remotes/two/branches/*' &&
t/t9110-git-svn-use-svm-props.sh +4 -4
index d4ab01f..9df60ba 100755
@@ -8,11 +8,11 @@ test_description='git-svn useSvmProps test'
 . ./lib-git-svn.sh
 
 test_expect_success 'load svm repo' "
-	svnadmin load -q '$rawsvnrepo' < ../t9110/svm.dump &&
-	git-svn init --minimize-url -R arr -i bar '$svnrepo/mirror/arr' &&
-	git-svn init --minimize-url -R argh -i dir '$svnrepo/mirror/argh' &&
+	svnadmin load -q \"$rawsvnrepo\" < ../t9110/svm.dump &&
+	git-svn init --minimize-url -R arr -i bar \"$svnrepo/mirror/arr\" &&
+	git-svn init --minimize-url -R argh -i dir \"$svnrepo/mirror/argh\" &&
 	git-svn init --minimize-url -R argh -i e \
-	  '$svnrepo/mirror/argh/a/b/c/d/e' &&
+	  \"$svnrepo/mirror/argh/a/b/c/d/e\" &&
 	git config svn.useSvmProps true &&
 	git-svn fetch --all
 	"
t/t9111-git-svn-use-svnsync-props.sh +4 -4
index 936f023..e3693eb 100755
@@ -8,10 +8,10 @@ test_description='git-svn useSvnsyncProps test'
 . ./lib-git-svn.sh
 
 test_expect_success 'load svnsync repo' "
-	svnadmin load -q '$rawsvnrepo' < ../t9111/svnsync.dump &&
-	git-svn init --minimize-url -R arr -i bar '$svnrepo/bar' &&
-	git-svn init --minimize-url -R argh -i dir '$svnrepo/dir' &&
-	git-svn init --minimize-url -R argh -i e '$svnrepo/dir/a/b/c/d/e' &&
+	svnadmin load -q \"$rawsvnrepo\" < ../t9111/svnsync.dump &&
+	git-svn init --minimize-url -R arr -i bar \"$svnrepo/bar\" &&
+	git-svn init --minimize-url -R argh -i dir \"$svnrepo/dir\" &&
+	git-svn init --minimize-url -R argh -i e \"$svnrepo/dir/a/b/c/d/e\" &&
 	git config svn.useSvnsyncProps true &&
 	git-svn fetch --all
 	"
t/t9112-git-svn-md5less-file.sh +2 -2
index b095583..124120c 100755
@@ -38,8 +38,8 @@ PROPS-END
 
 EOF
 
-test_expect_success 'load svn dumpfile' "svnadmin load '$rawsvnrepo' < dumpfile.svn"
+test_expect_success 'load svn dumpfile' "svnadmin load \"$rawsvnrepo\" < dumpfile.svn"
 
-test_expect_success 'initialize git-svn' "git-svn init '$svnrepo'"
+test_expect_success 'initialize git-svn' "git-svn init \"$svnrepo\""
 test_expect_success 'fetch revisions from svn' 'git-svn fetch'
 test_done
t/t9113-git-svn-dcommit-new-file.sh +3 -3
index 0088c75..150d7f0 100755
@@ -15,14 +15,14 @@ test_description='git-svn dcommit new files over svn:// test'
 
 start_svnserve () {
 	svnserve --listen-port $SVNSERVE_PORT \
-	         --root '$rawsvnrepo' \
+	         --root "$rawsvnrepo" \
 	         --listen-once \
 	         --listen-host 127.0.0.1 &
 }
 
 test_expect_success 'start tracking an empty repo' "
-	svn mkdir -m 'empty dir' '$svnrepo/empty-dir' &&
-	echo anon-access = write >> '$rawsvnrepo/conf/svnserve.conf' &&
+	svn mkdir -m 'empty dir' \"$svnrepo/empty-dir\" &&
+	echo anon-access = write >> \"$rawsvnrepo/conf/svnserve.conf\" &&
 	start_svnserve &&
 	git svn init svn://127.0.0.1:$SVNSERVE_PORT &&
 	git svn fetch
t/t9114-git-svn-dcommit-merge.sh +2 -2
index 64ec7fd..ffe8859 100755
@@ -35,7 +35,7 @@ EOF
 }
 
 test_expect_success 'setup svn repository' "
-	svn co '$svnrepo' mysvnwork &&
+	svn co \"$svnrepo\" mysvnwork &&
 	mkdir -p mysvnwork/trunk &&
 	cd mysvnwork &&
 		big_text_block >> trunk/README &&
@@ -45,7 +45,7 @@ test_expect_success 'setup svn repository' "
 	"
 
 test_expect_success 'setup git mirror and merge' "
-	git svn init '$svnrepo' -t tags -T trunk -b branches &&
+	git svn init \"$svnrepo\" -t tags -T trunk -b branches &&
 	git svn fetch &&
 	git checkout --track -b svn remotes/trunk &&
 	git checkout -b merge &&
t/t9115-git-svn-dcommit-funky-renames.sh +2 -2
index 653578d..0681ffa 100755
@@ -8,12 +8,12 @@ test_description='git-svn dcommit can commit renames of files with ugly names'
 . ./lib-git-svn.sh
 
 test_expect_success 'load repository with strange names' "
-	svnadmin load -q '$rawsvnrepo' < ../t9115/funky-names.dump &&
+	svnadmin load -q \"$rawsvnrepo\" < ../t9115/funky-names.dump &&
 	start_httpd
 	"
 
 test_expect_success 'init and fetch repository' "
-	git svn init '$svnrepo' &&
+	git svn init \"$svnrepo\" &&
 	git svn fetch &&
 	git reset --hard git-svn
 	"
t/t9116-git-svn-log.sh +2 -2
index 70c0c5f..890b5f1 100755
@@ -14,9 +14,9 @@ test_expect_success 'setup repository and import' "
 			mkdir -p \$i && \
 			echo hello >> \$i/README || exit 1
 		done && \
-		svn import -m test . '$svnrepo'
+		svn import -m test . \"$svnrepo\"
 		cd .. &&
-	git-svn init '$svnrepo' -T trunk -b branches -t tags &&
+	git-svn init \"$svnrepo\" -T trunk -b branches -t tags &&
 	git-svn fetch &&
 	git reset --hard trunk &&
 	echo bye >> README &&
Signature · 1 line
1.5.3.1
#37 lore raw
In reply to Andreas Ericsson

OK, second attempt at this. First patch fixes quoting in git rebase. Second patch allows you to run tests from a path with a space in. The third allows you to run tests from a path with an apostrophe in (and is where things start to get a bit ugly, hence the separate patch).