* [PATCH] Fixing path quoting issues
From: maillist @ 2007-10-10 21:22 UTC (permalink / raw)
To: git; +Cc: Jonathan del Strother
From: Jonathan del Strother <jon.delStrother@bestbefore.tv>
git-rebase and a number of tests didn't properly quote paths, leading to problems when run from a path with a space in.
Signed-off-by: Jonathan del Strother <jon.delStrother@bestbefore.tv>
---
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(-)
diff --git a/git-rebase.sh b/git-rebase.sh
index 1583402..b48397e 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -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"
diff --git a/t/t1020-subdirectory.sh b/t/t1020-subdirectory.sh
index b9cef34..5ed7fa4 100755
--- a/t/t1020-subdirectory.sh
+++ b/t/t1020-subdirectory.sh
@@ -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 &&
diff --git a/t/t3050-subprojects-fetch.sh b/t/t3050-subprojects-fetch.sh
index 34f26a8..4b74cc6 100755
--- a/t/t3050-subprojects-fetch.sh
+++ b/t/t3050-subprojects-fetch.sh
@@ -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 &&
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index 1113904..f321787 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -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' '
diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh
index 7b6798d..5489ffe 100755
--- a/t/t5500-fetch-pack.sh
+++ b/t/t5500-fetch-pack.sh
@@ -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
diff --git a/t/t5700-clone-reference.sh b/t/t5700-clone-reference.sh
index 4e93aaa..8bb34f9 100755
--- a/t/t5700-clone-reference.sh
+++ b/t/t5700-clone-reference.sh
@@ -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"
diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh
index e935b20..1ab5392 100755
--- a/t/t7003-filter-branch.sh
+++ b/t/t7003-filter-branch.sh
@@ -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' '
diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh
index b151b51..f3d0ab9 100644
--- a/t/t7501-commit.sh
+++ b/t/t7501-commit.sh
@@ -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
@@ -80,40 +80,40 @@ test_expect_success \
test_expect_failure \
"passing -m and -F" \
"echo 'enough with the bongos' >file && \
- git-commit -F msg -m amending ."
+ git-commit -F msg -m amending ."
test_expect_success \
- "using message from other commit" \
- "git-commit -C HEAD^ ."
+ "using message from other commit" \
+ "git-commit -C HEAD^ ."
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
test_expect_success \
- "editing message from other commit" \
- "echo 'hula hula' >file && \
- VISUAL=./editor git-commit -c HEAD^ -a"
+ "editing message from other commit" \
+ "echo 'hula hula' >file && \
+ VISUAL=./editor git-commit -c HEAD^ -a"
test_expect_success \
- "message from stdin" \
- "echo 'silly new contents' >file && \
- echo commit message from stdin | git-commit -F - -a"
+ "message from stdin" \
+ "echo 'silly new contents' >file && \
+ echo commit message from stdin | git-commit -F - -a"
test_expect_success \
- "overriding author from command line" \
- "echo 'gak' >file && \
- git-commit -m 'author' --author 'Rubber Duck <rduck@convoy.org>' -a"
+ "overriding author from command line" \
+ "echo 'gak' >file && \
+ git-commit -m 'author' --author 'Rubber Duck <rduck@convoy.org>' -a"
test_expect_success \
- "interactive add" \
- "echo 7 | git-commit --interactive | grep 'What now'"
+ "interactive add" \
+ "echo 7 | git-commit --interactive | grep 'What now'"
test_expect_success \
- "showing committed revisions" \
- "git-rev-list HEAD >current"
+ "showing committed revisions" \
+ "git-rev-list HEAD >current"
# We could just check the head sha1, but checking each commit makes it
# easier to isolate bugs.
@@ -128,38 +128,38 @@ d381ac431806e53f3dd7ac2f1ae0534f36d738b9
EOF
test_expect_success \
- 'validate git-rev-list output.' \
- 'diff current expected'
+ 'validate git-rev-list output.' \
+ 'diff current expected'
test_expect_success 'partial commit that involves removal (1)' '
- git rm --cached file &&
- mv file elif &&
- git add elif &&
- git commit -m "Partial: add elif" elif &&
- git diff-tree --name-status HEAD^ HEAD >current &&
- echo "A elif" >expected &&
- diff expected current
+ git rm --cached file &&
+ mv file elif &&
+ git add elif &&
+ git commit -m "Partial: add elif" elif &&
+ git diff-tree --name-status HEAD^ HEAD >current &&
+ echo "A elif" >expected &&
+ diff -b expected current
'
test_expect_success 'partial commit that involves removal (2)' '
- git commit -m "Partial: remove file" file &&
- git diff-tree --name-status HEAD^ HEAD >current &&
- echo "D file" >expected &&
- diff expected current
+ git commit -m "Partial: remove file" file &&
+ git diff-tree --name-status HEAD^ HEAD >current &&
+ echo "D file" >expected &&
+ diff -b expected current
'
test_expect_success 'partial commit that involves removal (3)' '
- git rm --cached elif &&
- echo elif >elif &&
- git commit -m "Partial: modify elif" elif &&
- git diff-tree --name-status HEAD^ HEAD >current &&
- echo "M elif" >expected &&
- diff expected current
+ git rm --cached elif &&
+ echo elif >elif &&
+ git commit -m "Partial: modify elif" elif &&
+ git diff-tree --name-status HEAD^ HEAD >current &&
+ echo "M elif" >expected &&
+ diff -b expected current
'
diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh
index 614cf50..c3585da 100755
--- a/t/t9100-git-svn-basic.sh
+++ b/t/t9100-git-svn-basic.sh
@@ -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 \
diff --git a/t/t9101-git-svn-props.sh b/t/t9101-git-svn-props.sh
index 5aac644..a1c85e0 100755
--- a/t/t9101-git-svn-props.sh
+++ b/t/t9101-git-svn-props.sh
@@ -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
diff --git a/t/t9102-git-svn-deep-rmdir.sh b/t/t9102-git-svn-deep-rmdir.sh
index 4e08083..99c8840 100755
--- a/t/t9102-git-svn-deep-rmdir.sh
+++ b/t/t9102-git-svn-deep-rmdir.sh
@@ -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
"
diff --git a/t/t9104-git-svn-follow-parent.sh b/t/t9104-git-svn-follow-parent.sh
index 7ba7630..aa2bfe2 100755
--- a/t/t9104-git-svn-follow-parent.sh
+++ b/t/t9104-git-svn-follow-parent.sh
@@ -11,9 +11,9 @@ test_expect_success 'initialize repo' "
cd import &&
mkdir -p trunk &&
echo hello > trunk/readme &&
- svn import -m 'initial' . $svnrepo &&
+ svn import -m 'initial' . '$svnrepo' &&
cd .. &&
- svn co $svnrepo wc &&
+ svn co '$svnrepo' wc &&
cd wc &&
echo world >> trunk/readme &&
poke trunk/readme &&
@@ -27,7 +27,7 @@ test_expect_success 'initialize repo' "
"
test_expect_success 'init and fetch a moved directory' "
- git-svn init --minimize-url -i thunk $svnrepo/thunk &&
+ git-svn init --minimize-url -i thunk '$svnrepo/thunk' &&
git-svn fetch -i thunk &&
test \"\`git rev-parse --verify refs/remotes/thunk@2\`\" \
= \"\`git rev-parse --verify refs/remotes/thunk~1\`\" &&
@@ -38,7 +38,7 @@ test_expect_success 'init and fetch a moved directory' "
"
test_expect_success 'init and fetch from one svn-remote' "
- git config svn-remote.svn.url $svnrepo &&
+ git config svn-remote.svn.url '$svnrepo' &&
git config --add svn-remote.svn.fetch \
trunk:refs/remotes/svn/trunk &&
git config --add svn-remote.svn.fetch \
@@ -52,9 +52,9 @@ test_expect_success 'init and fetch from one svn-remote' "
test_expect_success 'follow deleted parent' "
(svn cp -m 'resurrecting trunk as junk' \
- $svnrepo/trunk@2 $svnrepo/junk ||
+ '$svnrepo/trunk@2' '$svnrepo'/junk ||
svn cp -m 'resurrecting trunk as junk' \
- -r2 $svnrepo/trunk $svnrepo/junk) &&
+ -r2 '$svnrepo/trunk' '$svnrepo/junk') &&
git config --add svn-remote.svn.fetch \
junk:refs/remotes/svn/junk &&
git-svn fetch -i svn/thunk &&
@@ -67,10 +67,10 @@ test_expect_success 'follow deleted parent' "
test_expect_success 'follow larger parent' "
mkdir -p import/trunk/thunk/bump/thud &&
echo hi > import/trunk/thunk/bump/thud/file &&
- svn import -m 'import a larger parent' import $svnrepo/larger-parent &&
- svn cp -m 'hi' $svnrepo/larger-parent $svnrepo/another-larger &&
+ svn import -m 'import a larger parent' import '$svnrepo/larger-parent' &&
+ svn cp -m 'hi' '$svnrepo/larger-parent' '$svnrepo/another-larger' &&
git-svn init --minimize-url -i larger \
- $svnrepo/another-larger/trunk/thunk/bump/thud &&
+ '$svnrepo/another-larger/trunk/thunk/bump/thud' &&
git-svn fetch -i larger &&
git rev-parse --verify refs/remotes/larger &&
git rev-parse --verify \
@@ -83,23 +83,23 @@ test_expect_success 'follow larger parent' "
"
test_expect_success 'follow higher-level parent' "
- svn mkdir -m 'follow higher-level parent' $svnrepo/blob &&
- svn co $svnrepo/blob blob &&
+ svn mkdir -m 'follow higher-level parent' '$svnrepo/blob' &&
+ svn co '$svnrepo/blob' blob &&
cd blob &&
echo hi > hi &&
svn add hi &&
svn commit -m 'hihi' &&
cd ..
- svn mkdir -m 'new glob at top level' $svnrepo/glob &&
- svn mv -m 'move blob down a level' $svnrepo/blob $svnrepo/glob/blob &&
- git-svn init --minimize-url -i blob $svnrepo/glob/blob &&
+ svn mkdir -m 'new glob at top level' '$svnrepo/glob' &&
+ svn mv -m 'move blob down a level' '$svnrepo/blob' '$svnrepo/glob/blob' &&
+ git-svn init --minimize-url -i blob '$svnrepo/glob/blob' &&
git-svn fetch -i blob
"
test_expect_success 'follow deleted directory' "
- svn mv -m 'bye!' $svnrepo/glob/blob/hi $svnrepo/glob/blob/bye &&
- svn rm -m 'remove glob' $svnrepo/glob &&
- git-svn init --minimize-url -i glob $svnrepo/glob &&
+ svn mv -m 'bye!' '$svnrepo/glob/blob/hi' '$svnrepo/glob/blob/bye' &&
+ svn rm -m 'remove glob' '$svnrepo/glob' &&
+ git-svn init --minimize-url -i glob '$svnrepo/glob' &&
git-svn fetch -i glob &&
test \"\`git cat-file blob refs/remotes/glob:blob/bye\`\" = hi &&
test \"\`git ls-tree refs/remotes/glob | wc -l \`\" -eq 1
@@ -118,9 +118,9 @@ test_expect_success 'follow-parent avoids deleting relevant info' "
echo 'bad delete test 2' > \
import/trunk/subversion/bindings/swig/perl/another-larger &&
cd import &&
- svn import -m 'r9270 test' . $svnrepo/r9270 &&
+ svn import -m 'r9270 test' . '$svnrepo/r9270' &&
cd .. &&
- svn co $svnrepo/r9270/trunk/subversion/bindings/swig/perl r9270 &&
+ svn co '$svnrepo/r9270/trunk/subversion/bindings/swig/perl' r9270 &&
cd r9270 &&
svn mkdir native &&
svn mv t native/t &&
@@ -130,7 +130,7 @@ test_expect_success 'follow-parent avoids deleting relevant info' "
svn commit -m 'reorg test' &&
cd .. &&
git-svn init --minimize-url -i r9270-t \
- $svnrepo/r9270/trunk/subversion/bindings/swig/perl/native/t &&
+ '$svnrepo/r9270/trunk/subversion/bindings/swig/perl/native/t' &&
git-svn fetch -i r9270-t &&
test \`git rev-list r9270-t | wc -l\` -eq 2 &&
test \"\`git ls-tree --name-only r9270-t~1\`\" = \
@@ -138,9 +138,9 @@ test_expect_success 'follow-parent avoids deleting relevant info' "
"
test_expect_success "track initial change if it was only made to parent" "
- svn cp -m 'wheee!' $svnrepo/r9270/trunk $svnrepo/r9270/drunk &&
+ svn cp -m 'wheee!' '$svnrepo/r9270/trunk' '$svnrepo/r9270/drunk' &&
git-svn init --minimize-url -i r9270-d \
- $svnrepo/r9270/drunk/subversion/bindings/swig/perl/native/t &&
+ '$svnrepo/r9270/drunk/subversion/bindings/swig/perl/native/t' &&
git-svn fetch -i r9270-d &&
test \`git rev-list r9270-d | wc -l\` -eq 3 &&
test \"\`git ls-tree --name-only r9270-t\`\" = \
@@ -150,7 +150,7 @@ test_expect_success "track initial change if it was only made to parent" "
"
test_expect_success "track multi-parent paths" "
- svn cp -m 'resurrect /glob' $svnrepo/r9270 $svnrepo/glob &&
+ svn cp -m 'resurrect /glob' '$svnrepo/r9270' '$svnrepo/glob' &&
git-svn multi-fetch &&
test \`git cat-file commit refs/remotes/glob | \
grep '^parent ' | wc -l\` -eq 2
@@ -161,8 +161,8 @@ test_expect_success "multi-fetch continues to work" "
"
test_expect_success "multi-fetch works off a 'clean' repository" "
- rm -r $GIT_DIR/svn $GIT_DIR/refs/remotes $GIT_DIR/logs &&
- mkdir $GIT_DIR/svn &&
+ rm -r '$GIT_DIR/svn' '$GIT_DIR/refs/remotes' '$GIT_DIR/logs' &&
+ mkdir '$GIT_DIR/svn' &&
git-svn multi-fetch
"
diff --git a/t/t9105-git-svn-commit-diff.sh b/t/t9105-git-svn-commit-diff.sh
index 318e172..2e1eb75 100755
--- a/t/t9105-git-svn-commit-diff.sh
+++ b/t/t9105-git-svn-commit-diff.sh
@@ -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
"
diff --git a/t/t9106-git-svn-commit-diff-clobber.sh b/t/t9106-git-svn-commit-diff-clobber.sh
index 79b7968..bb42339 100755
--- a/t/t9106-git-svn-commit-diff-clobber.sh
+++ b/t/t9106-git-svn-commit-diff-clobber.sh
@@ -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 &&
diff --git a/t/t9107-git-svn-migrate.sh b/t/t9107-git-svn-migrate.sh
index 67fdf70..90bf786 100755
--- a/t/t9107-git-svn-migrate.sh
+++ b/t/t9107-git-svn-migrate.sh
@@ -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
diff --git a/t/t9108-git-svn-glob.sh b/t/t9108-git-svn-glob.sh
index db4344c..c6dc0ef 100755
--- a/t/t9108-git-svn-glob.sh
+++ b/t/t9108-git-svn-glob.sh
@@ -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/*' &&
diff --git a/t/t9110-git-svn-use-svm-props.sh b/t/t9110-git-svn-use-svm-props.sh
index 6235af4..d4ab01f 100755
--- a/t/t9110-git-svn-use-svm-props.sh
+++ b/t/t9110-git-svn-use-svm-props.sh
@@ -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
"
diff --git a/t/t9111-git-svn-use-svnsync-props.sh b/t/t9111-git-svn-use-svnsync-props.sh
index ec7dedd..936f023 100755
--- a/t/t9111-git-svn-use-svnsync-props.sh
+++ b/t/t9111-git-svn-use-svnsync-props.sh
@@ -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
"
diff --git a/t/t9112-git-svn-md5less-file.sh b/t/t9112-git-svn-md5less-file.sh
index 08313bb..b095583 100755
--- a/t/t9112-git-svn-md5less-file.sh
+++ b/t/t9112-git-svn-md5less-file.sh
@@ -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
diff --git a/t/t9113-git-svn-dcommit-new-file.sh b/t/t9113-git-svn-dcommit-new-file.sh
index 9ef0db9..0088c75 100755
--- a/t/t9113-git-svn-dcommit-new-file.sh
+++ b/t/t9113-git-svn-dcommit-new-file.sh
@@ -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
diff --git a/t/t9114-git-svn-dcommit-merge.sh b/t/t9114-git-svn-dcommit-merge.sh
index d6ca955..64ec7fd 100755
--- a/t/t9114-git-svn-dcommit-merge.sh
+++ b/t/t9114-git-svn-dcommit-merge.sh
@@ -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 &&
diff --git a/t/t9115-git-svn-dcommit-funky-renames.sh b/t/t9115-git-svn-dcommit-funky-renames.sh
index 182299c..653578d 100755
--- a/t/t9115-git-svn-dcommit-funky-renames.sh
+++ b/t/t9115-git-svn-dcommit-funky-renames.sh
@@ -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
"
diff --git a/t/t9116-git-svn-log.sh b/t/t9116-git-svn-log.sh
index 0d4e6b3..70c0c5f 100755
--- a/t/t9116-git-svn-log.sh
+++ b/t/t9116-git-svn-log.sh
@@ -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 &&
diff --git a/t/test-lib.sh b/t/test-lib.sh
index cc1253c..a68415f 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -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"
--
1.5.3.1
^ permalink raw reply related
* [PATCH] Fixing path quoting issues
From: Jonathan del Strother @ 2007-10-10 21:13 UTC (permalink / raw)
To: git, gitster; +Cc: Jonathan del Strother
git-rebase and a number of tests didn't properly quote paths, leading to problems when run from a path with a space in.
Signed-off-by: Jonathan del Strother <jon.delStrother@bestbefore.tv>
---
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(-)
diff --git a/git-rebase.sh b/git-rebase.sh
index 1583402..b48397e 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -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"
diff --git a/t/t1020-subdirectory.sh b/t/t1020-subdirectory.sh
index b9cef34..5ed7fa4 100755
--- a/t/t1020-subdirectory.sh
+++ b/t/t1020-subdirectory.sh
@@ -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 &&
diff --git a/t/t3050-subprojects-fetch.sh b/t/t3050-subprojects-fetch.sh
index 34f26a8..4b74cc6 100755
--- a/t/t3050-subprojects-fetch.sh
+++ b/t/t3050-subprojects-fetch.sh
@@ -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 &&
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index 1113904..f321787 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -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' '
diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh
index 7b6798d..5489ffe 100755
--- a/t/t5500-fetch-pack.sh
+++ b/t/t5500-fetch-pack.sh
@@ -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
diff --git a/t/t5700-clone-reference.sh b/t/t5700-clone-reference.sh
index 4e93aaa..8bb34f9 100755
--- a/t/t5700-clone-reference.sh
+++ b/t/t5700-clone-reference.sh
@@ -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"
diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh
index e935b20..1ab5392 100755
--- a/t/t7003-filter-branch.sh
+++ b/t/t7003-filter-branch.sh
@@ -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' '
diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh
index b151b51..f3d0ab9 100644
--- a/t/t7501-commit.sh
+++ b/t/t7501-commit.sh
@@ -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
@@ -80,40 +80,40 @@ test_expect_success \
test_expect_failure \
"passing -m and -F" \
"echo 'enough with the bongos' >file && \
- git-commit -F msg -m amending ."
+ git-commit -F msg -m amending ."
test_expect_success \
- "using message from other commit" \
- "git-commit -C HEAD^ ."
+ "using message from other commit" \
+ "git-commit -C HEAD^ ."
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
test_expect_success \
- "editing message from other commit" \
- "echo 'hula hula' >file && \
- VISUAL=./editor git-commit -c HEAD^ -a"
+ "editing message from other commit" \
+ "echo 'hula hula' >file && \
+ VISUAL=./editor git-commit -c HEAD^ -a"
test_expect_success \
- "message from stdin" \
- "echo 'silly new contents' >file && \
- echo commit message from stdin | git-commit -F - -a"
+ "message from stdin" \
+ "echo 'silly new contents' >file && \
+ echo commit message from stdin | git-commit -F - -a"
test_expect_success \
- "overriding author from command line" \
- "echo 'gak' >file && \
- git-commit -m 'author' --author 'Rubber Duck <rduck@convoy.org>' -a"
+ "overriding author from command line" \
+ "echo 'gak' >file && \
+ git-commit -m 'author' --author 'Rubber Duck <rduck@convoy.org>' -a"
test_expect_success \
- "interactive add" \
- "echo 7 | git-commit --interactive | grep 'What now'"
+ "interactive add" \
+ "echo 7 | git-commit --interactive | grep 'What now'"
test_expect_success \
- "showing committed revisions" \
- "git-rev-list HEAD >current"
+ "showing committed revisions" \
+ "git-rev-list HEAD >current"
# We could just check the head sha1, but checking each commit makes it
# easier to isolate bugs.
@@ -128,38 +128,38 @@ d381ac431806e53f3dd7ac2f1ae0534f36d738b9
EOF
test_expect_success \
- 'validate git-rev-list output.' \
- 'diff current expected'
+ 'validate git-rev-list output.' \
+ 'diff current expected'
test_expect_success 'partial commit that involves removal (1)' '
- git rm --cached file &&
- mv file elif &&
- git add elif &&
- git commit -m "Partial: add elif" elif &&
- git diff-tree --name-status HEAD^ HEAD >current &&
- echo "A elif" >expected &&
- diff expected current
+ git rm --cached file &&
+ mv file elif &&
+ git add elif &&
+ git commit -m "Partial: add elif" elif &&
+ git diff-tree --name-status HEAD^ HEAD >current &&
+ echo "A elif" >expected &&
+ diff -b expected current
'
test_expect_success 'partial commit that involves removal (2)' '
- git commit -m "Partial: remove file" file &&
- git diff-tree --name-status HEAD^ HEAD >current &&
- echo "D file" >expected &&
- diff expected current
+ git commit -m "Partial: remove file" file &&
+ git diff-tree --name-status HEAD^ HEAD >current &&
+ echo "D file" >expected &&
+ diff -b expected current
'
test_expect_success 'partial commit that involves removal (3)' '
- git rm --cached elif &&
- echo elif >elif &&
- git commit -m "Partial: modify elif" elif &&
- git diff-tree --name-status HEAD^ HEAD >current &&
- echo "M elif" >expected &&
- diff expected current
+ git rm --cached elif &&
+ echo elif >elif &&
+ git commit -m "Partial: modify elif" elif &&
+ git diff-tree --name-status HEAD^ HEAD >current &&
+ echo "M elif" >expected &&
+ diff -b expected current
'
diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh
index 614cf50..c3585da 100755
--- a/t/t9100-git-svn-basic.sh
+++ b/t/t9100-git-svn-basic.sh
@@ -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 \
diff --git a/t/t9101-git-svn-props.sh b/t/t9101-git-svn-props.sh
index 5aac644..a1c85e0 100755
--- a/t/t9101-git-svn-props.sh
+++ b/t/t9101-git-svn-props.sh
@@ -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
diff --git a/t/t9102-git-svn-deep-rmdir.sh b/t/t9102-git-svn-deep-rmdir.sh
index 4e08083..99c8840 100755
--- a/t/t9102-git-svn-deep-rmdir.sh
+++ b/t/t9102-git-svn-deep-rmdir.sh
@@ -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
"
diff --git a/t/t9104-git-svn-follow-parent.sh b/t/t9104-git-svn-follow-parent.sh
index 7ba7630..aa2bfe2 100755
--- a/t/t9104-git-svn-follow-parent.sh
+++ b/t/t9104-git-svn-follow-parent.sh
@@ -11,9 +11,9 @@ test_expect_success 'initialize repo' "
cd import &&
mkdir -p trunk &&
echo hello > trunk/readme &&
- svn import -m 'initial' . $svnrepo &&
+ svn import -m 'initial' . '$svnrepo' &&
cd .. &&
- svn co $svnrepo wc &&
+ svn co '$svnrepo' wc &&
cd wc &&
echo world >> trunk/readme &&
poke trunk/readme &&
@@ -27,7 +27,7 @@ test_expect_success 'initialize repo' "
"
test_expect_success 'init and fetch a moved directory' "
- git-svn init --minimize-url -i thunk $svnrepo/thunk &&
+ git-svn init --minimize-url -i thunk '$svnrepo/thunk' &&
git-svn fetch -i thunk &&
test \"\`git rev-parse --verify refs/remotes/thunk@2\`\" \
= \"\`git rev-parse --verify refs/remotes/thunk~1\`\" &&
@@ -38,7 +38,7 @@ test_expect_success 'init and fetch a moved directory' "
"
test_expect_success 'init and fetch from one svn-remote' "
- git config svn-remote.svn.url $svnrepo &&
+ git config svn-remote.svn.url '$svnrepo' &&
git config --add svn-remote.svn.fetch \
trunk:refs/remotes/svn/trunk &&
git config --add svn-remote.svn.fetch \
@@ -52,9 +52,9 @@ test_expect_success 'init and fetch from one svn-remote' "
test_expect_success 'follow deleted parent' "
(svn cp -m 'resurrecting trunk as junk' \
- $svnrepo/trunk@2 $svnrepo/junk ||
+ '$svnrepo/trunk@2' '$svnrepo'/junk ||
svn cp -m 'resurrecting trunk as junk' \
- -r2 $svnrepo/trunk $svnrepo/junk) &&
+ -r2 '$svnrepo/trunk' '$svnrepo/junk') &&
git config --add svn-remote.svn.fetch \
junk:refs/remotes/svn/junk &&
git-svn fetch -i svn/thunk &&
@@ -67,10 +67,10 @@ test_expect_success 'follow deleted parent' "
test_expect_success 'follow larger parent' "
mkdir -p import/trunk/thunk/bump/thud &&
echo hi > import/trunk/thunk/bump/thud/file &&
- svn import -m 'import a larger parent' import $svnrepo/larger-parent &&
- svn cp -m 'hi' $svnrepo/larger-parent $svnrepo/another-larger &&
+ svn import -m 'import a larger parent' import '$svnrepo/larger-parent' &&
+ svn cp -m 'hi' '$svnrepo/larger-parent' '$svnrepo/another-larger' &&
git-svn init --minimize-url -i larger \
- $svnrepo/another-larger/trunk/thunk/bump/thud &&
+ '$svnrepo/another-larger/trunk/thunk/bump/thud' &&
git-svn fetch -i larger &&
git rev-parse --verify refs/remotes/larger &&
git rev-parse --verify \
@@ -83,23 +83,23 @@ test_expect_success 'follow larger parent' "
"
test_expect_success 'follow higher-level parent' "
- svn mkdir -m 'follow higher-level parent' $svnrepo/blob &&
- svn co $svnrepo/blob blob &&
+ svn mkdir -m 'follow higher-level parent' '$svnrepo/blob' &&
+ svn co '$svnrepo/blob' blob &&
cd blob &&
echo hi > hi &&
svn add hi &&
svn commit -m 'hihi' &&
cd ..
- svn mkdir -m 'new glob at top level' $svnrepo/glob &&
- svn mv -m 'move blob down a level' $svnrepo/blob $svnrepo/glob/blob &&
- git-svn init --minimize-url -i blob $svnrepo/glob/blob &&
+ svn mkdir -m 'new glob at top level' '$svnrepo/glob' &&
+ svn mv -m 'move blob down a level' '$svnrepo/blob' '$svnrepo/glob/blob' &&
+ git-svn init --minimize-url -i blob '$svnrepo/glob/blob' &&
git-svn fetch -i blob
"
test_expect_success 'follow deleted directory' "
- svn mv -m 'bye!' $svnrepo/glob/blob/hi $svnrepo/glob/blob/bye &&
- svn rm -m 'remove glob' $svnrepo/glob &&
- git-svn init --minimize-url -i glob $svnrepo/glob &&
+ svn mv -m 'bye!' '$svnrepo/glob/blob/hi' '$svnrepo/glob/blob/bye' &&
+ svn rm -m 'remove glob' '$svnrepo/glob' &&
+ git-svn init --minimize-url -i glob '$svnrepo/glob' &&
git-svn fetch -i glob &&
test \"\`git cat-file blob refs/remotes/glob:blob/bye\`\" = hi &&
test \"\`git ls-tree refs/remotes/glob | wc -l \`\" -eq 1
@@ -118,9 +118,9 @@ test_expect_success 'follow-parent avoids deleting relevant info' "
echo 'bad delete test 2' > \
import/trunk/subversion/bindings/swig/perl/another-larger &&
cd import &&
- svn import -m 'r9270 test' . $svnrepo/r9270 &&
+ svn import -m 'r9270 test' . '$svnrepo/r9270' &&
cd .. &&
- svn co $svnrepo/r9270/trunk/subversion/bindings/swig/perl r9270 &&
+ svn co '$svnrepo/r9270/trunk/subversion/bindings/swig/perl' r9270 &&
cd r9270 &&
svn mkdir native &&
svn mv t native/t &&
@@ -130,7 +130,7 @@ test_expect_success 'follow-parent avoids deleting relevant info' "
svn commit -m 'reorg test' &&
cd .. &&
git-svn init --minimize-url -i r9270-t \
- $svnrepo/r9270/trunk/subversion/bindings/swig/perl/native/t &&
+ '$svnrepo/r9270/trunk/subversion/bindings/swig/perl/native/t' &&
git-svn fetch -i r9270-t &&
test \`git rev-list r9270-t | wc -l\` -eq 2 &&
test \"\`git ls-tree --name-only r9270-t~1\`\" = \
@@ -138,9 +138,9 @@ test_expect_success 'follow-parent avoids deleting relevant info' "
"
test_expect_success "track initial change if it was only made to parent" "
- svn cp -m 'wheee!' $svnrepo/r9270/trunk $svnrepo/r9270/drunk &&
+ svn cp -m 'wheee!' '$svnrepo/r9270/trunk' '$svnrepo/r9270/drunk' &&
git-svn init --minimize-url -i r9270-d \
- $svnrepo/r9270/drunk/subversion/bindings/swig/perl/native/t &&
+ '$svnrepo/r9270/drunk/subversion/bindings/swig/perl/native/t' &&
git-svn fetch -i r9270-d &&
test \`git rev-list r9270-d | wc -l\` -eq 3 &&
test \"\`git ls-tree --name-only r9270-t\`\" = \
@@ -150,7 +150,7 @@ test_expect_success "track initial change if it was only made to parent" "
"
test_expect_success "track multi-parent paths" "
- svn cp -m 'resurrect /glob' $svnrepo/r9270 $svnrepo/glob &&
+ svn cp -m 'resurrect /glob' '$svnrepo/r9270' '$svnrepo/glob' &&
git-svn multi-fetch &&
test \`git cat-file commit refs/remotes/glob | \
grep '^parent ' | wc -l\` -eq 2
@@ -161,8 +161,8 @@ test_expect_success "multi-fetch continues to work" "
"
test_expect_success "multi-fetch works off a 'clean' repository" "
- rm -r $GIT_DIR/svn $GIT_DIR/refs/remotes $GIT_DIR/logs &&
- mkdir $GIT_DIR/svn &&
+ rm -r '$GIT_DIR/svn' '$GIT_DIR/refs/remotes' '$GIT_DIR/logs' &&
+ mkdir '$GIT_DIR/svn' &&
git-svn multi-fetch
"
diff --git a/t/t9105-git-svn-commit-diff.sh b/t/t9105-git-svn-commit-diff.sh
index 318e172..2e1eb75 100755
--- a/t/t9105-git-svn-commit-diff.sh
+++ b/t/t9105-git-svn-commit-diff.sh
@@ -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
"
diff --git a/t/t9106-git-svn-commit-diff-clobber.sh b/t/t9106-git-svn-commit-diff-clobber.sh
index 79b7968..bb42339 100755
--- a/t/t9106-git-svn-commit-diff-clobber.sh
+++ b/t/t9106-git-svn-commit-diff-clobber.sh
@@ -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 &&
diff --git a/t/t9107-git-svn-migrate.sh b/t/t9107-git-svn-migrate.sh
index 67fdf70..90bf786 100755
--- a/t/t9107-git-svn-migrate.sh
+++ b/t/t9107-git-svn-migrate.sh
@@ -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
diff --git a/t/t9108-git-svn-glob.sh b/t/t9108-git-svn-glob.sh
index db4344c..c6dc0ef 100755
--- a/t/t9108-git-svn-glob.sh
+++ b/t/t9108-git-svn-glob.sh
@@ -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/*' &&
diff --git a/t/t9110-git-svn-use-svm-props.sh b/t/t9110-git-svn-use-svm-props.sh
index 6235af4..d4ab01f 100755
--- a/t/t9110-git-svn-use-svm-props.sh
+++ b/t/t9110-git-svn-use-svm-props.sh
@@ -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
"
diff --git a/t/t9111-git-svn-use-svnsync-props.sh b/t/t9111-git-svn-use-svnsync-props.sh
index ec7dedd..936f023 100755
--- a/t/t9111-git-svn-use-svnsync-props.sh
+++ b/t/t9111-git-svn-use-svnsync-props.sh
@@ -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
"
diff --git a/t/t9112-git-svn-md5less-file.sh b/t/t9112-git-svn-md5less-file.sh
index 08313bb..b095583 100755
--- a/t/t9112-git-svn-md5less-file.sh
+++ b/t/t9112-git-svn-md5less-file.sh
@@ -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
diff --git a/t/t9113-git-svn-dcommit-new-file.sh b/t/t9113-git-svn-dcommit-new-file.sh
index 9ef0db9..0088c75 100755
--- a/t/t9113-git-svn-dcommit-new-file.sh
+++ b/t/t9113-git-svn-dcommit-new-file.sh
@@ -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
diff --git a/t/t9114-git-svn-dcommit-merge.sh b/t/t9114-git-svn-dcommit-merge.sh
index d6ca955..64ec7fd 100755
--- a/t/t9114-git-svn-dcommit-merge.sh
+++ b/t/t9114-git-svn-dcommit-merge.sh
@@ -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 &&
diff --git a/t/t9115-git-svn-dcommit-funky-renames.sh b/t/t9115-git-svn-dcommit-funky-renames.sh
index 182299c..653578d 100755
--- a/t/t9115-git-svn-dcommit-funky-renames.sh
+++ b/t/t9115-git-svn-dcommit-funky-renames.sh
@@ -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
"
diff --git a/t/t9116-git-svn-log.sh b/t/t9116-git-svn-log.sh
index 0d4e6b3..70c0c5f 100755
--- a/t/t9116-git-svn-log.sh
+++ b/t/t9116-git-svn-log.sh
@@ -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 &&
diff --git a/t/test-lib.sh b/t/test-lib.sh
index cc1253c..a68415f 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -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"
--
1.5.3.1
^ permalink raw reply related
* Re: git branch performance problem?
From: Han-Wen Nienhuys @ 2007-10-10 21:24 UTC (permalink / raw)
To: Lars Hjemli; +Cc: git
In-Reply-To: <f329bf540710101417w640b2421v73279cc8e34449b8@mail.gmail.com>
2007/10/10, Han-Wen Nienhuys <hanwenn@gmail.com>:
> > You probably want to run 'git gc' (which will run 'git pack-refs',
> > i.e. put all files currently under .git/refs into a single file). This
> > should speed up 'git branch' (and quite possibly other commands too).
>
> This seems rather unuseful. After running gc pack-refs --all, I lost my HEAD,
>
> hanwen@lilypond:~/vc/git5$ git show HEAD
> fatal: ambiguous argument 'HEAD': unknown revision or path not in the
> working tree.
More to the point, I seemed to have lost my entire repository. This is
the type of surprise I don't enjoy.
Now, can someone explain why 'git branch' takes forever if there are
only two non-remote branches ?
--
Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen
^ permalink raw reply
* RE: [FEATURE REQUEST] git clone, just clone selected branches?
From: Joakim Tjernlund @ 2007-10-10 21:25 UTC (permalink / raw)
To: 'Johannes Schindelin'; +Cc: git
In-Reply-To: <Pine.LNX.4.64.0710102032330.4174@racer.site>
> -----Original Message-----
> From: Johannes Schindelin [mailto:Johannes.Schindelin@gmx.de]
> Sent: den 10 oktober 2007 21:35
> To: Joakim Tjernlund
> Cc: git@vger.kernel.org
> Subject: Re: [FEATURE REQUEST] git clone, just clone selected
> branches?
>
> Hi,
>
> On Wed, 10 Oct 2007, Joakim Tjernlund wrote:
>
> > To my knowlede a git clone always clones all branches from
> the remote
> > repo. I would like the possibly to clone selected branches, like
> > git clone <repo URL> -b master -b upstream
> > which will only fetch the master and upstream branch.
> >
> > I know I can use git remote to do this, but it is a bit clumsy when
> > starting a new repo.
>
> This is why I suggest: since it is an itch of yours, just fix
> it. You are
> in the prime position to know when you're satisfied.
>
> As a hint how to start: Junio dreamt of a git-clone which is a tiny
> wrapper around git-fetch and git-remote.
>
> So you could start by writing a script which would be a
> replacement for
> git-clone.sh, and there you can also include the support for
> -b that you
> would like so much.
>
> It would be nice, though, to keep this in separate patches,
> which you then
> submit to this list.
>
> Thank you,
> Dscho
Thank you for these words of visdom, I should know better
than to throw out ideas like this. Next time I have an suggestion
I will think long and hard about it before posting again.
Jocke
^ permalink raw reply
* Re: [PATCH] Fixed crash in fetching remote tags when there is not tags.
From: Alex Riesen @ 2007-10-10 21:27 UTC (permalink / raw)
To: Jeff King; +Cc: Väinö Järvelä, git, Junio C Hamano
In-Reply-To: <20071010051034.GA30834@coredump.intra.peff.net>
Jeff King, Wed, Oct 10, 2007 07:10:35 +0200:
> On Tue, Oct 09, 2007 at 08:20:43PM +0200, Alex Riesen wrote:
>
> > Your test does not crash on my system and your fix is obviously bogus.
> > Just take a look at the only call site of the tail_link_ref: ret
> > cannot be NULL. alloc_ref will crash in memset, if this were the case.
>
> His work is almost certainly on top of next, which crashes reliably with
> the test and has an additional call site for tail_link_ref. Aside from
> some trailing whitespace in the patch, I think his fix is reasonable.
Ach, I see.
Still, I'd suggest move the test into the caller, firstly because it
is the only place that special. Also, I can't think of a proper reason
to add a NULL ref to a reflist, and so the crashing tail_link_ref will
help us find the callers which use tail_link_ref incorrectly
(illogically too).
As the result of patter expansion can be NULL (empty pattern, as it
seems), lets just check for it. I parked the patch below locally.
diff --git a/remote.c b/remote.c
index 5e92378..58d63ed 100644
--- a/remote.c
+++ b/remote.c
@@ -884,7 +884,8 @@ int get_fetch_map(struct ref *remote_refs,
rm->peer_ref->name);
}
- tail_link_ref(ref_map, tail);
+ if (ref_map)
+ tail_link_ref(ref_map, tail);
return 0;
}
^ permalink raw reply related
* Re: git branch performance problem?
From: Han-Wen Nienhuys @ 2007-10-10 21:30 UTC (permalink / raw)
To: Lars Hjemli; +Cc: git
In-Reply-To: <f329bf540710101424q22309489sada99907e94b2cd0@mail.gmail.com>
2007/10/10, Han-Wen Nienhuys <hanwenn@gmail.com>:
> More to the point, I seemed to have lost my entire repository. This is
> the type of surprise I don't enjoy.
>
> Now, can someone explain why 'git branch' takes forever if there are
> only two non-remote branches ?
So,
Here is a question: I would like to share commitishes between two checkouts
of a repository. The reason for this is that I want to easily cherry
pick back and forth between the two. The files of in one of them
should be continually available, since I am running out of that
directory.
The way I solved that, was to have both repositories pointing to each
other, using alternates.
Now, after a couple of gc and pack-refs iterations, I am greeted by
hanwen@lilypond:~/vc/git6$ git fsck
missing tree 12b00ec3190f7b46a5fe0a3235445bead4c9645b
broken link from tree 1718d09e0394d113c162e4a3471e7a1f20914a94
to blob 635e2802568b85017007698c0e6dd4d28dca496f
broken link from tree 926899798fce75038e24f8fa1838f6da8bcf105f
to tree f1b852d270ebbaaf95d8ddc06c52763bad11ff25
missing blob 99f0c0d63276fce444e3a200167b636236784c52
missing tree f1b852d270ebbaaf95d8ddc06c52763bad11ff25
missing blob 236962a87fafae8ca2dce2dc550d344aa7a8884a
missing blob 7d69ca297f392a954c4cdcb62bb4c8a90ddb862b
missing blob 9e39be8f5cb4eeff97fcfd6eb77fefeda02f0e71
dangling blob f3a93f023080ce9fc6becb397e366cc4ceb192f5
could it be that GC does not handle cyclic alternates correctly?
--
Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen
^ permalink raw reply
* Re: [PATCH] Fixed crash in fetching remote tags when there is not tags.
From: Jeff King @ 2007-10-10 21:33 UTC (permalink / raw)
To: Alex Riesen; +Cc: Väinö Järvelä, git, Junio C Hamano
In-Reply-To: <20071010212735.GB16635@steel.home>
On Wed, Oct 10, 2007 at 11:27:35PM +0200, Alex Riesen wrote:
> Still, I'd suggest move the test into the caller, firstly because it
> is the only place that special. Also, I can't think of a proper reason
Yes, I agree with that. I came very close to suggesting it in my other
mail, but then realized I had never even looked at the surrounding code,
and I ought not to be making assessments of how that data structure
should be used. But now there are two of us. :)
-Peff
^ permalink raw reply
* Re: git branch performance problem?
From: Lars Hjemli @ 2007-10-10 21:34 UTC (permalink / raw)
To: hanwen; +Cc: git
In-Reply-To: <f329bf540710101424q22309489sada99907e94b2cd0@mail.gmail.com>
On 10/10/07, Han-Wen Nienhuys <hanwenn@gmail.com> wrote:
> 2007/10/10, Han-Wen Nienhuys <hanwenn@gmail.com>:
> > > You probably want to run 'git gc' (which will run 'git pack-refs',
> > > i.e. put all files currently under .git/refs into a single file). This
> > > should speed up 'git branch' (and quite possibly other commands too).
> >
> > This seems rather unuseful. After running gc pack-refs --all, I lost my HEAD,
> >
> > hanwen@lilypond:~/vc/git5$ git show HEAD
> > fatal: ambiguous argument 'HEAD': unknown revision or path not in the
> > working tree.
>
> More to the point, I seemed to have lost my entire repository. This is
> the type of surprise I don't enjoy.
Yeah, this is bad, I'm sorry to have caused you trouble. But I fail to
see how 'git pack-refs --all' could possibly trash your repository. A
few questions:
What version of git are you using?
What's the output from these commands:
$ cat .git/packed-refs
$ cat .git/HEAD
$ find .git/refs -type f | wc -l
> Now, can someone explain why 'git branch' takes forever if there are
> only two non-remote branches ?
That's because git-branch always traverses the complete directory tree
below .git/refs, even if you only want to see the 'local' branches (I
have a patch cooking to fix this).
--
larsh
^ permalink raw reply
* RE: [FEATURE REQUEST] git clone, just clone selected branches?
From: Joakim Tjernlund @ 2007-10-10 21:36 UTC (permalink / raw)
To: 'Linus Torvalds'; +Cc: git
In-Reply-To: <alpine.LFD.0.999.0710101236350.20690@woody.linux-foundation.org>
> -----Original Message-----
> From: Linus Torvalds [mailto:torvalds@linux-foundation.org]
> Sent: den 10 oktober 2007 21:38
> To: Joakim Tjernlund
> Cc: git@vger.kernel.org
> Subject: Re: [FEATURE REQUEST] git clone, just clone selected
> branches?
>
>
>
> On Wed, 10 Oct 2007, Joakim Tjernlund wrote:
> >
> > I know I can use git remote to do this, but it is a bit clumsy
> > when starting a new repo.
>
> How about just
>
> git init
> .. set up remote tracking info in .git/config ..
> git fetch remote
>
> which should do what you want.
>
> Linus
>From git remote man page:
o Imitate git clone but track only selected branches
$ mkdir project.git
$ cd project.git
$ git init
$ git remote add -f -t master -m master origin git://example.com/git.git/
$ git merge origin
yes, this does the trick too but that is more to type so I thought
it would be simpler if I could just tell git clone which branches I want.
Now, this isn't a killer feature to me so if you don't like it, I good
with that too.
Jocke
^ permalink raw reply
* Re: git branch performance problem?
From: J. Bruce Fields @ 2007-10-10 21:39 UTC (permalink / raw)
To: hanwen; +Cc: Lars Hjemli, git
In-Reply-To: <f329bf540710101430i63926b25q7d55976af96b891d@mail.gmail.com>
On Wed, Oct 10, 2007 at 06:30:02PM -0300, Han-Wen Nienhuys wrote:
> 2007/10/10, Han-Wen Nienhuys <hanwenn@gmail.com>:
> > More to the point, I seemed to have lost my entire repository. This is
> > the type of surprise I don't enjoy.
> >
> > Now, can someone explain why 'git branch' takes forever if there are
> > only two non-remote branches ?
>
> So,
>
> Here is a question: I would like to share commitishes between two checkouts
> of a repository. The reason for this is that I want to easily cherry
> pick back and forth between the two. The files of in one of them
> should be continually available, since I am running out of that
> directory.
>
> The way I solved that, was to have both repositories pointing to each
> other, using alternates.
>
> Now, after a couple of gc and pack-refs iterations, I am greeted by
>
> hanwen@lilypond:~/vc/git6$ git fsck
> missing tree 12b00ec3190f7b46a5fe0a3235445bead4c9645b
> broken link from tree 1718d09e0394d113c162e4a3471e7a1f20914a94
> to blob 635e2802568b85017007698c0e6dd4d28dca496f
> broken link from tree 926899798fce75038e24f8fa1838f6da8bcf105f
> to tree f1b852d270ebbaaf95d8ddc06c52763bad11ff25
> missing blob 99f0c0d63276fce444e3a200167b636236784c52
> missing tree f1b852d270ebbaaf95d8ddc06c52763bad11ff25
> missing blob 236962a87fafae8ca2dce2dc550d344aa7a8884a
> missing blob 7d69ca297f392a954c4cdcb62bb4c8a90ddb862b
> missing blob 9e39be8f5cb4eeff97fcfd6eb77fefeda02f0e71
> dangling blob f3a93f023080ce9fc6becb397e366cc4ceb192f5
>
>
> could it be that GC does not handle cyclic alternates correctly?
Does it handle alternates at all? If you run git-gc on a repository
which other repositories get objects from, then my impression was that
bad things happen.
--b.
^ permalink raw reply
* Re: git branch performance problem?
From: Lars Hjemli @ 2007-10-10 21:45 UTC (permalink / raw)
To: J. Bruce Fields; +Cc: hanwen, git
In-Reply-To: <20071010213925.GB2963@fieldses.org>
On 10/10/07, J. Bruce Fields <bfields@fieldses.org> wrote:
> On Wed, Oct 10, 2007 at 06:30:02PM -0300, Han-Wen Nienhuys wrote:
> > could it be that GC does not handle cyclic alternates correctly?
>
> Does it handle alternates at all? If you run git-gc on a repository
> which other repositories get objects from, then my impression was that
> bad things happen.
>
AFAIK 'git gc' is safe, while 'git gc --prune' will remove loose
(unreferenced) objects.
--
larsh
^ permalink raw reply
* Re: git branch performance problem?
From: Han-Wen Nienhuys @ 2007-10-10 21:49 UTC (permalink / raw)
To: Lars Hjemli; +Cc: J. Bruce Fields, git
In-Reply-To: <8c5c35580710101445h232f9a67jd0c326b3b97ae3dd@mail.gmail.com>
2007/10/10, Lars Hjemli <hjemli@gmail.com>:
> On 10/10/07, J. Bruce Fields <bfields@fieldses.org> wrote:
> > On Wed, Oct 10, 2007 at 06:30:02PM -0300, Han-Wen Nienhuys wrote:
> > > could it be that GC does not handle cyclic alternates correctly?
> >
> > Does it handle alternates at all? If you run git-gc on a repository
> > which other repositories get objects from, then my impression was that
> > bad things happen.
> >
>
> AFAIK 'git gc' is safe, while 'git gc --prune' will remove loose
> (unreferenced) objects.
Yes, I think that in this case, gc --prune was run accidentally, but
given that the history of the program invoking git just died, I'm not
sure how to figure that out.
Maybe gc --prune could follow the alternates and abort if a cycle was detected?
--
Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen
^ permalink raw reply
* Re: git branch performance problem?
From: J. Bruce Fields @ 2007-10-10 21:53 UTC (permalink / raw)
To: hanwen; +Cc: Lars Hjemli, git
In-Reply-To: <f329bf540710101449oad9c9dg85f3821f55fb85ea@mail.gmail.com>
On Wed, Oct 10, 2007 at 06:49:19PM -0300, Han-Wen Nienhuys wrote:
> 2007/10/10, Lars Hjemli <hjemli@gmail.com>:
> > On 10/10/07, J. Bruce Fields <bfields@fieldses.org> wrote:
> > > On Wed, Oct 10, 2007 at 06:30:02PM -0300, Han-Wen Nienhuys wrote:
> > > > could it be that GC does not handle cyclic alternates correctly?
> > >
> > > Does it handle alternates at all? If you run git-gc on a repository
> > > which other repositories get objects from, then my impression was that
> > > bad things happen.
> > >
> >
> > AFAIK 'git gc' is safe, while 'git gc --prune' will remove loose
> > (unreferenced) objects.
>
> Yes, I think that in this case, gc --prune was run accidentally, but
> given that the history of the program invoking git just died, I'm not
> sure how to figure that out.
>
> Maybe gc --prune could follow the alternates and abort if a cycle was detected?
Don't the alternates point in the wrong direction? You'd need pointers
back from the main repository to the repositories that depend on it for
objects.
Which would be nice....
--b.
^ permalink raw reply
* Re: git branch performance problem?
From: Johannes Schindelin @ 2007-10-10 21:53 UTC (permalink / raw)
To: hanwen; +Cc: Lars Hjemli, J. Bruce Fields, git
In-Reply-To: <f329bf540710101449oad9c9dg85f3821f55fb85ea@mail.gmail.com>
Hi,
On Wed, 10 Oct 2007, Han-Wen Nienhuys wrote:
> 2007/10/10, Lars Hjemli <hjemli@gmail.com>:
> > On 10/10/07, J. Bruce Fields <bfields@fieldses.org> wrote:
> > > On Wed, Oct 10, 2007 at 06:30:02PM -0300, Han-Wen Nienhuys wrote:
> > > > could it be that GC does not handle cyclic alternates correctly?
> > >
> > > Does it handle alternates at all? If you run git-gc on a repository
> > > which other repositories get objects from, then my impression was
> > > that bad things happen.
> > >
> >
> > AFAIK 'git gc' is safe, while 'git gc --prune' will remove loose
> > (unreferenced) objects.
>
> Yes, I think that in this case, gc --prune was run accidentally, but
> given that the history of the program invoking git just died, I'm not
> sure how to figure that out.
>
> Maybe gc --prune could follow the alternates and abort if a cycle was
> detected?
I think we talked about this quite some time ago, and the resolution was
that it is too hard.
Now that it bit somebody in real life, I think we have to try harder.
And probably the best place to check would be git-prune, not git-gc, since
that is the program (called by gc) that most probably killed your repo.
Come to think of it, it should probably be part of git-repack, too.
Will try to cobble up a patch,
Dscho
^ permalink raw reply
* [PATCH] git-branch: only traverse the requested refs
From: Lars Hjemli @ 2007-10-10 21:54 UTC (permalink / raw)
To: Han-Wen Nienhuys; +Cc: git, Junio C Hamano
In-Reply-To: <f329bf540710101424q22309489sada99907e94b2cd0@mail.gmail.com>
This avoids looking at every single file below .git/refs when git-branch
is fetching the list of refs to display.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
---
This patch should make git-branch much more efficient when there exists
many files below .git/refs, but it does require two passes through
.git/packed-refs when -a is specified.
No benchmarking performed...
builtin-branch.c | 28 +++++++++-------------------
1 files changed, 9 insertions(+), 19 deletions(-)
diff --git a/builtin-branch.c b/builtin-branch.c
index 3da8b55..466e1e0 100644
--- a/builtin-branch.c
+++ b/builtin-branch.c
@@ -185,25 +185,8 @@ static int append_ref(const char *refname, const unsigned char *sha1, int flags,
{
struct ref_list *ref_list = (struct ref_list*)(cb_data);
struct ref_item *newitem;
- int kind = REF_UNKNOWN_TYPE;
int len;
- /* Detect kind */
- if (!prefixcmp(refname, "refs/heads/")) {
- kind = REF_LOCAL_BRANCH;
- refname += 11;
- } else if (!prefixcmp(refname, "refs/remotes/")) {
- kind = REF_REMOTE_BRANCH;
- refname += 13;
- } else if (!prefixcmp(refname, "refs/tags/")) {
- kind = REF_TAG;
- refname += 10;
- }
-
- /* Don't add types the caller doesn't want */
- if ((kind & ref_list->kinds) == 0)
- return 0;
-
/* Resize buffer */
if (ref_list->index >= ref_list->alloc) {
ref_list->alloc = alloc_nr(ref_list->alloc);
@@ -214,7 +197,7 @@ static int append_ref(const char *refname, const unsigned char *sha1, int flags,
/* Record the new item */
newitem = &(ref_list->list[ref_list->index++]);
newitem->name = xstrdup(refname);
- newitem->kind = kind;
+ newitem->kind = ref_list->kinds;
hashcpy(newitem->sha1, sha1);
len = strlen(newitem->name);
if (len > ref_list->maxwidth)
@@ -296,8 +279,15 @@ static void print_ref_list(int kinds, int detached, int verbose, int abbrev)
struct ref_list ref_list;
memset(&ref_list, 0, sizeof(ref_list));
+ if (kinds & REF_LOCAL_BRANCH) {
+ ref_list.kinds = REF_LOCAL_BRANCH;
+ for_each_branch_ref(append_ref, &ref_list);
+ }
+ if (kinds & REF_REMOTE_BRANCH) {
+ ref_list.kinds = REF_REMOTE_BRANCH;
+ for_each_remote_ref(append_ref, &ref_list);
+ }
ref_list.kinds = kinds;
- for_each_ref(append_ref, &ref_list);
qsort(ref_list.list, ref_list.index, sizeof(struct ref_item), ref_cmp);
--
1.5.3.4.206.g58ba4
^ permalink raw reply related
* RE: [FEATURE REQUEST] git clone, just clone selected branches?
From: Johannes Schindelin @ 2007-10-10 21:56 UTC (permalink / raw)
To: Joakim Tjernlund; +Cc: git
In-Reply-To: <011b01c80b84$222d1e70$04ac10ac@Jocke>
Hi,
On Wed, 10 Oct 2007, Joakim Tjernlund wrote:
> I should know better than to throw out ideas like this. Next time I have
> an suggestion I will think long and hard about it before posting again.
Hey, it was just a try.
Personally, I am not interested in the feature _you_ asked for, but I
thought it might be pretty easy for you to rewrite git-clone.sh to take
advantage of git-fetch and git-remote, and that your desired feature would
be easier to add then. So easy that the whole thing would have taken you
all of an hour or so.
But maybe somebody else is interested enough to scratch your itch.
Ciao,
Dscho
^ permalink raw reply
* Re: git branch performance problem?
From: Han-Wen Nienhuys @ 2007-10-10 22:01 UTC (permalink / raw)
To: J. Bruce Fields; +Cc: Lars Hjemli, git
In-Reply-To: <20071010215317.GC2963@fieldses.org>
2007/10/10, J. Bruce Fields <bfields@fieldses.org>:
> > Maybe gc --prune could follow the alternates and abort if a cycle was detected?
>
> Don't the alternates point in the wrong direction? You'd need pointers
> back from the main repository to the repositories that depend on it for
> objects.
>
> Which would be nice....
The development repo was cloned from the main repo; then sometimes I
cherry pick from development into the main repo. Hence alternates in 2
directions.
--
Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen
^ permalink raw reply
* [PATCH] clear_commit_marks(): avoid deep recursion
From: Johannes Schindelin @ 2007-10-10 22:14 UTC (permalink / raw)
To: git, hjemli, gitster; +Cc: spearce
Before this patch, clear_commit_marks() recursed for each parent. This
could be potentially very expensive in terms of stack space. Probably
the only reason that this did not lead to problems is the fact that we
typically call clear_commit_marks() after marking a relatively small set
of commits.
Use (sort of) a tail recursion instead: first recurse on the parents
other than the first one, and then continue the loop with the first
parent.
Noticed by Shawn Pearce.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
commit.c | 23 ++++++++++++++---------
1 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/commit.c b/commit.c
index 20fb220..ac24266 100644
--- a/commit.c
+++ b/commit.c
@@ -441,17 +441,22 @@ struct commit *pop_most_recent_commit(struct commit_list **list,
void clear_commit_marks(struct commit *commit, unsigned int mark)
{
- struct commit_list *parents;
+ while (commit) {
+ struct commit_list *parents;
- commit->object.flags &= ~mark;
- parents = commit->parents;
- while (parents) {
- struct commit *parent = parents->item;
+ if (!(mark & commit->object.flags))
+ return;
- /* Have we already cleared this? */
- if (mark & parent->object.flags)
- clear_commit_marks(parent, mark);
- parents = parents->next;
+ commit->object.flags &= ~mark;
+
+ parents = commit->parents;
+ if (!parents)
+ return;
+
+ while ((parents = parents->next))
+ clear_commit_marks(parents->item, mark);
+
+ commit = commit->parents->item;
}
}
--
1.5.3.4.1169.g5fb8d
^ permalink raw reply related
* RE: [FEATURE REQUEST] git clone, just clone selected branches?
From: Joakim Tjernlund @ 2007-10-10 22:41 UTC (permalink / raw)
To: 'Johannes Schindelin'; +Cc: git
In-Reply-To: <Pine.LNX.4.64.0710102254340.4174@racer.site>
> -----Original Message-----
> From: Johannes Schindelin [mailto:Johannes.Schindelin@gmx.de]
>
> Hi,
>
> On Wed, 10 Oct 2007, Joakim Tjernlund wrote:
>
> > I should know better than to throw out ideas like this.
> Next time I have
> > an suggestion I will think long and hard about it before
> posting again.
>
> Hey, it was just a try.
Some people might get scared away from such tries
>
> Personally, I am not interested in the feature _you_ asked for, but I
NP, if it only me that is interested then this is probably not such a good idea.
> thought it might be pretty easy for you to rewrite
> git-clone.sh to take
> advantage of git-fetch and git-remote, and that your desired
> feature would
> be easier to add then. So easy that the whole thing would
> have taken you
> all of an hour or so.
Well, now I had to take a look and I think you are overestimating my capabilities :)
It is a 12KB script full of git-plumbing I have never used, nor do I do
sh scripts well. It might be an hour for you, but I would probably have
to spend the whole day :)
Jocke
>
> But maybe somebody else is interested enough to scratch your itch.
>
> Ciao,
> Dscho
>
>
>
^ permalink raw reply
* Re: Spam: Re: git branch performance problem?
From: Brandon Casey @ 2007-10-10 22:55 UTC (permalink / raw)
To: Lars Hjemli; +Cc: J. Bruce Fields, hanwen, git
In-Reply-To: <8c5c35580710101445h232f9a67jd0c326b3b97ae3dd@mail.gmail.com>
Lars Hjemli wrote:
> On 10/10/07, J. Bruce Fields <bfields@fieldses.org> wrote:
>> On Wed, Oct 10, 2007 at 06:30:02PM -0300, Han-Wen Nienhuys wrote:
>>> could it be that GC does not handle cyclic alternates correctly?
>> Does it handle alternates at all? If you run git-gc on a repository
>> which other repositories get objects from, then my impression was that
>> bad things happen.
>>
>
> AFAIK 'git gc' is safe, while 'git gc --prune' will remove loose
> (unreferenced) objects.
No, this is not the case, unless something has changed very recently
in git-gc or git-repack. Even git-gc with no arguments is unsafe if
the repository being gc'ed is listed in another's alternates.
git-gc calls repack with -a and -d. which causes a new pack to be
created which only contains the objects required by the local repository.
The other packs are then deleted. Objects contained in those packs and
required by a "sharing" repository (one using the alternates mechanism)
will be deleted if the local repository no longer references them.
Maybe git-gc should make use of repack's new -A option by default and
only use -a (and not -A) when --prune is specified...
-brandon
^ permalink raw reply
* Re: [PATCH] git-branch: only traverse the requested refs
From: Johannes Schindelin @ 2007-10-10 23:00 UTC (permalink / raw)
To: Lars Hjemli; +Cc: Han-Wen Nienhuys, git, Junio C Hamano
In-Reply-To: <1192053283-2351-1-git-send-email-hjemli@gmail.com>
Hi,
On Wed, 10 Oct 2007, Lars Hjemli wrote:
> This avoids looking at every single file below .git/refs when git-branch
> is fetching the list of refs to display.
>
> [...]
>
> + if (kinds & REF_LOCAL_BRANCH) {
> + ref_list.kinds = REF_LOCAL_BRANCH;
> + for_each_branch_ref(append_ref, &ref_list);
> + }
The function for_each_branch_ref() calls do_for_each_ref(), which in turn
calls get_loose_refs(), which calls get_ref_dir() to read all loose refs,
if they have not yet been read.
So I think that your patch (unfortunately) will no help Han-Wen's
situation.
Ciao,
Dscho
^ permalink raw reply
* RE: [FEATURE REQUEST] git clone, just clone selected branches?
From: Johannes Schindelin @ 2007-10-10 23:01 UTC (permalink / raw)
To: Joakim Tjernlund; +Cc: git
In-Reply-To: <011d01c80b8e$b0c0dc30$04ac10ac@Jocke>
Hi,
On Thu, 11 Oct 2007, Joakim Tjernlund wrote:
> > -----Original Message-----
> > From: Johannes Schindelin [mailto:Johannes.Schindelin@gmx.de]
> >
> > thought it might be pretty easy for you to rewrite git-clone.sh to
> > take advantage of git-fetch and git-remote, and that your desired
> > feature would be easier to add then. So easy that the whole thing
> > would have taken you all of an hour or so.
>
> Well, now I had to take a look and I think you are overestimating my
> capabilities :) It is a 12KB script full of git-plumbing I have never
> used, nor do I do sh scripts well. It might be an hour for you, but I
> would probably have to spend the whole day :)
Heh. git-clone is pretty crowded. But it predates git-remote. And I
have a hunch that git-clone will be a trivial script when it calls
git-remote and the git-fetch.
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH] git-branch: only traverse the requested refs
From: Lars Hjemli @ 2007-10-10 23:30 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Han-Wen Nienhuys, git, Junio C Hamano
In-Reply-To: <Pine.LNX.4.64.0710102358110.4174@racer.site>
On 10/11/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> On Wed, 10 Oct 2007, Lars Hjemli wrote:
> > + if (kinds & REF_LOCAL_BRANCH) {
> > + ref_list.kinds = REF_LOCAL_BRANCH;
> > + for_each_branch_ref(append_ref, &ref_list);
> > + }
>
> The function for_each_branch_ref() calls do_for_each_ref(), which in turn
> calls get_loose_refs(), which calls get_ref_dir() to read all loose refs,
> if they have not yet been read.
Ok, I'll see if get_loose_refs() could take 'const char *base' and
pass this on to get_ref_dir(), which should solve the problem.
Thanks for noticing.
--
larsh
^ permalink raw reply
* [PATCH 0/2] Add --dry-run option to git-push
From: Baz @ 2007-10-10 23:34 UTC (permalink / raw)
To: GIT list; +Cc: Junio C Hamano
Hi,
there was discussion recently about the default behaviour of git-push
having the potential to confuse, making it easy to push commits that
are still cooking in other branches.
Its also possible for newbies to make mistakes with refspecs, but
there's no way to know if you've got the syntax right without actually
pushing. Steffan suggested a dry-run flag, which I've always wanted
too, so here's an attempt. Patches git-send-pack, git-push, their
docs, and adds a test for git-push.
Treat me gentle... first patch to the list and the mailer will
probably mangle it (sigh)
Cheers,
Baz
Diffstat:
Documentation/git-push.txt | 6 +++++-
Documentation/git-send-pack.txt | 5 ++++-
builtin-push.c | 10 ++++++++--
send-pack.c | 31 +++++++++++++++++++------------
t/t5516-fetch-push.sh | 10 ++++++++++
5 files changed, 46 insertions(+), 16 deletions(-)
^ permalink raw reply
* [PATCH 1/2] Add a --dry-run option to git-send-pack.
From: Brian Ewins @ 2007-10-10 23:34 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano
Signed-off-by: Brian Ewins <brian.ewins@gmail.com>
---
Documentation/git-send-pack.txt | 5 ++++-
send-pack.c | 31 +++++++++++++++++++------------
2 files changed, 23 insertions(+), 13 deletions(-)
diff --git a/Documentation/git-send-pack.txt b/Documentation/git-send-
pack.txt
index 3271e88..9e2783c 100644
--- a/Documentation/git-send-pack.txt
+++ b/Documentation/git-send-pack.txt
@@ -8,7 +8,7 @@ git-send-pack - Push objects over git protocol to
another repository
SYNOPSIS
--------
-'git-send-pack' [--all] [--force] [--receive-pack=<git-receive-
pack>] [--verbose] [--thin] [<host>:]<directory> [<ref>...]
+'git-send-pack' [--all] [--dry-run] [--force] [--receive-pack=<git-
receive-pack>] [--verbose] [--thin] [<host>:]<directory> [<ref>...]
DESCRIPTION
-----------
@@ -34,6 +34,9 @@ OPTIONS
Instead of explicitly specifying which refs to update,
update all heads that locally exist.
+\--dry-run::
+ Show what would have been updated, but do not send any updates.
+
\--force::
Usually, the command refuses to update a remote ref that
is not an ancestor of the local ref used to overwrite it.
diff --git a/send-pack.c b/send-pack.c
index f74e66a..e8bef4f 100644
--- a/send-pack.c
+++ b/send-pack.c
@@ -7,13 +7,14 @@
#include "remote.h"
static const char send_pack_usage[] =
-"git-send-pack [--all] [--force] [--receive-pack=<git-receive-pack>]
[--verbose] [--thin] [<host>:]<directory> [<ref>...]\n"
+"git-send-pack [--all] [--dry-run] [--force] [--receive-pack=<git-
receive-pack>] [--verbose] [--thin] [<host>:]<directory> [<ref>...]\n"
" --all and explicit <ref> specification are mutually exclusive.";
static const char *receivepack = "git-receive-pack";
static int verbose;
static int send_all;
static int force_update;
static int use_thin_pack;
+static int dry_run;
/*
* Make a pack stream and spit it out into file descriptor fd
@@ -282,16 +283,18 @@ static int send_pack(int in, int out, struct
remote *remote, int nr_refspec, cha
strcpy(old_hex, sha1_to_hex(ref->old_sha1));
new_hex = sha1_to_hex(ref->new_sha1);
- if (ask_for_status_report) {
- packet_write(out, "%s %s %s%c%s",
- old_hex, new_hex, ref->name, 0,
- "report-status");
- ask_for_status_report = 0;
- expect_status_report = 1;
+ if (!dry_run) {
+ if (ask_for_status_report) {
+ packet_write(out, "%s %s %s%c%s",
+ old_hex, new_hex, ref->name, 0,
+ "report-status");
+ ask_for_status_report = 0;
+ expect_status_report = 1;
+ }
+ else
+ packet_write(out, "%s %s %s",
+ old_hex, new_hex, ref->name);
}
- else
- packet_write(out, "%s %s %s",
- old_hex, new_hex, ref->name);
if (will_delete_ref)
fprintf(stderr, "deleting '%s'\n", ref->name);
else {
@@ -302,7 +305,7 @@ static int send_pack(int in, int out, struct
remote *remote, int nr_refspec, cha
fprintf(stderr, "\n from %s\n to %s\n",
old_hex, new_hex);
}
- if (remote) {
+ if (remote && !dry_run) {
struct refspec rs;
rs.src = ref->name;
rs.dst = NULL;
@@ -321,7 +324,7 @@ static int send_pack(int in, int out, struct
remote *remote, int nr_refspec, cha
}
packet_flush(out);
- if (new_refs)
+ if (new_refs && !dry_run)
ret = pack_objects(out, remote_refs);
close(out);
@@ -390,6 +393,10 @@ int main(int argc, char **argv)
send_all = 1;
continue;
}
+ if (!strcmp(arg, "--dry-run")) {
+ dry_run = 1;
+ continue;
+ }
if (!strcmp(arg, "--force")) {
force_update = 1;
continue;
--
1.5.2.5
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox