Skip to content

Commit

Permalink
git-svn testsuite: use standard configuration for Subversion tools
Browse files Browse the repository at this point in the history
I have tweaked configuration in my ~/.subversion directory, namely I am
running auto-properties and automatically adding '$Id$' expansion to
every file.  This choke the last test named 'proplist' from
t9101-git-svn-props.sh, because one more property, svn:keywords is
automatically added.

I had just wrapped svn invocation with the svn_cmd that specifies empty
directory via --config-dir argument.  Since the latter is the global
option, it should be recognized by all svn subcommands, so no
regressions will be introduced.

Now svn_cmd is used everywhere, not just in the failed test module: this
should guard us from the future clashes with user-defined configuration
tweaks.

Signed-off-by: Eygene Ryabinkin <rea-git@codelabs.ru>
Acked-by: Eric Wong <normalperson@yhbt.net>
  • Loading branch information
Eygene Ryabinkin authored and Eric Wong committed May 21, 2009
1 parent 065b070 commit da083d6
Show file tree
Hide file tree
Showing 29 changed files with 221 additions and 206 deletions.
15 changes: 15 additions & 0 deletions t/lib-git-svn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ fi

svnrepo=$PWD/svnrepo
export svnrepo
svnconf=$PWD/svnconf
export svnconf

perl -w -e "
use SVN::Core;
Expand Down Expand Up @@ -54,6 +56,19 @@ poke() {
test-chmtime +1 "$1"
}

# We need this, because we should pass empty configuration directory to
# the 'svn commit' to avoid automated property changes and other stuff
# that could be set from user's configuration files in ~/.subversion.
svn_cmd () {
[ -d "$svnconf" ] || mkdir "$svnconf"
orig_svncmd="$1"; shift
if [ -z "$orig_svncmd" ]; then
svn
return
fi
svn "$orig_svncmd" --config-dir "$svnconf" "$@"
}

for d in \
"$SVN_HTTPD_PATH" \
/usr/sbin/apache2 \
Expand Down
14 changes: 7 additions & 7 deletions t/t9100-git-svn-basic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ 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_cmd import -m "import for git svn" . "$svnrepo" >/dev/null &&
cd .. &&
rm -rf import &&
git svn init "$svnrepo"'
Expand All @@ -51,7 +51,7 @@ test_expect_success "$name" '
git commit -m "$name" &&
git svn set-tree --find-copies-harder --rmdir \
${remotes_git_svn}..mybranch &&
svn up "$SVN_TREE" &&
svn_cmd up "$SVN_TREE" &&
test -d "$SVN_TREE"/dir && test ! -d "$SVN_TREE"/dir/a'


Expand Down Expand Up @@ -118,7 +118,7 @@ test_expect_success "$name" '
git commit -m "$name" &&
git svn set-tree --find-copies-harder --rmdir \
${remotes_git_svn}..mybranch5 &&
svn up "$SVN_TREE" &&
svn_cmd up "$SVN_TREE" &&
test ! -x "$SVN_TREE"/exec.sh'


Expand All @@ -129,7 +129,7 @@ test_expect_success "$name" '
git commit -m "$name" &&
git svn set-tree --find-copies-harder --rmdir \
${remotes_git_svn}..mybranch5 &&
svn up "$SVN_TREE" &&
svn_cmd up "$SVN_TREE" &&
test -x "$SVN_TREE"/exec.sh'


Expand All @@ -141,7 +141,7 @@ test_expect_success "$name" '
git commit -m "$name" &&
git svn set-tree --find-copies-harder --rmdir \
${remotes_git_svn}..mybranch5 &&
svn up "$SVN_TREE" &&
svn_cmd up "$SVN_TREE" &&
test -L "$SVN_TREE"/exec.sh'

name='new symlink is added to a file that was also just made executable'
Expand All @@ -153,7 +153,7 @@ test_expect_success "$name" '
git commit -m "$name" &&
git svn set-tree --find-copies-harder --rmdir \
${remotes_git_svn}..mybranch5 &&
svn up "$SVN_TREE" &&
svn_cmd up "$SVN_TREE" &&
test -x "$SVN_TREE"/bar/zzz &&
test -L "$SVN_TREE"/exec-2.sh'

Expand All @@ -166,7 +166,7 @@ test_expect_success "$name" '
git commit -m "$name" &&
git svn set-tree --find-copies-harder --rmdir \
${remotes_git_svn}..mybranch5 &&
svn up "$SVN_TREE" &&
svn_cmd up "$SVN_TREE" &&
test -f "$SVN_TREE"/exec-2.sh &&
test ! -L "$SVN_TREE"/exec-2.sh &&
test_cmp help "$SVN_TREE"/exec-2.sh'
Expand Down
38 changes: 19 additions & 19 deletions t/t9101-git-svn-props.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ EOF
printf "\r\n" > empty_crlf
a_empty_crlf=`git hash-object -w empty_crlf`

svn import --no-auto-props -m 'import for git svn' . "$svnrepo" >/dev/null
svn_cmd import --no-auto-props -m 'import for git svn' . "$svnrepo" >/dev/null
cd ..

rm -rf import
Expand All @@ -57,13 +57,13 @@ test_expect_success 'setup some commits to svn' \
'cd test_wc &&
echo Greetings >> kw.c &&
poke kw.c &&
svn commit -m "Not yet an Id" &&
svn_cmd commit -m "Not yet an Id" &&
echo Hello world >> kw.c &&
poke kw.c &&
svn commit -m "Modified file, but still not yet an Id" &&
svn propset svn:keywords Id kw.c &&
svn_cmd commit -m "Modified file, but still not yet an Id" &&
svn_cmd propset svn:keywords Id kw.c &&
poke kw.c &&
svn commit -m "Propset Id" &&
svn_cmd commit -m "Propset Id" &&
cd ..'

test_expect_success 'initialize git svn' 'git svn init "$svnrepo"'
Expand All @@ -83,16 +83,16 @@ test_expect_success 'raw $Id$ found in kw.c' "test '$expect' = '$got'"

test_expect_success "propset CR on crlf files" \
'cd test_wc &&
svn propset svn:eol-style CR empty &&
svn propset svn:eol-style CR crlf &&
svn propset svn:eol-style CR ne_crlf &&
svn commit -m "propset CR on crlf files" &&
svn_cmd propset svn:eol-style CR empty &&
svn_cmd propset svn:eol-style CR crlf &&
svn_cmd propset svn:eol-style CR ne_crlf &&
svn_cmd commit -m "propset CR on crlf files" &&
cd ..'

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_cmd co "$svnrepo" new_wc'

for i in crlf ne_crlf lf ne_lf cr ne_cr empty_cr empty_lf empty empty_crlf
do
Expand All @@ -106,11 +106,11 @@ cd test_wc
a_cr=`printf '$Id$\r\nHello\r\nWorld\r\n' | git hash-object --stdin`
a_ne_cr=`printf '$Id$\r\nHello\r\nWorld' | git hash-object --stdin`
test_expect_success 'Set CRLF on cr files' \
'svn propset svn:eol-style CRLF cr &&
svn propset svn:eol-style CRLF ne_cr &&
svn propset svn:keywords Id cr &&
svn propset svn:keywords Id ne_cr &&
svn commit -m "propset CRLF on cr files"'
'svn_cmd propset svn:eol-style CRLF cr &&
svn_cmd propset svn:eol-style CRLF ne_cr &&
svn_cmd propset svn:keywords Id cr &&
svn_cmd propset svn:keywords Id ne_cr &&
svn_cmd commit -m "propset CRLF on cr files"'
cd ..
test_expect_success 'fetch and pull latest from svn' \
'git svn fetch && git pull . ${remotes_git_svn}'
Expand Down Expand Up @@ -140,10 +140,10 @@ test_expect_success 'test show-ignore' "
cd test_wc &&
mkdir -p deeply/nested/directory &&
touch deeply/nested/directory/.keep &&
svn add deeply &&
svn up &&
svn propset -R svn:ignore 'no-such-file*' .
svn commit -m 'propset svn:ignore'
svn_cmd add deeply &&
svn_cmd up &&
svn_cmd propset -R svn:ignore 'no-such-file*' .
svn_cmd commit -m 'propset svn:ignore'
cd .. &&
git svn show-ignore > show-ignore.got &&
cmp show-ignore.expect show-ignore.got
Expand Down
4 changes: 2 additions & 2 deletions t/t9102-git-svn-deep-rmdir.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ 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_cmd import -m "import for git svn" . "$svnrepo" &&
cd ..
'

Expand All @@ -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_cmd ls -R "$svnrepo" | grep ^deeply/nested/directory/number/1
'


Expand Down
8 changes: 4 additions & 4 deletions t/t9103-git-svn-tracked-directory-removed.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ test_expect_success 'make history for tracking' '
mkdir import &&
mkdir import/trunk &&
echo hello >> import/trunk/README &&
svn import -m initial import "$svnrepo" &&
svn_cmd import -m initial import "$svnrepo" &&
rm -rf import &&
svn co "$svnrepo"/trunk trunk &&
svn_cmd co "$svnrepo"/trunk trunk &&
echo bye bye >> trunk/README &&
svn rm -m "gone" "$svnrepo"/trunk &&
svn_cmd rm -m "gone" "$svnrepo"/trunk &&
rm -rf trunk &&
mkdir trunk &&
echo "new" > trunk/FOLLOWME &&
svn import -m "new trunk" trunk "$svnrepo"/trunk
svn_cmd import -m "new trunk" trunk "$svnrepo"/trunk
'

test_expect_success 'clone repo with git' '
Expand Down
40 changes: 20 additions & 20 deletions t/t9104-git-svn-follow-parent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ test_expect_success 'initialize repo' '
cd import &&
mkdir -p trunk &&
echo hello > trunk/readme &&
svn import -m "initial" . "$svnrepo" &&
svn_cmd import -m "initial" . "$svnrepo" &&
cd .. &&
svn co "$svnrepo" wc &&
svn_cmd co "$svnrepo" wc &&
cd wc &&
echo world >> trunk/readme &&
poke trunk/readme &&
svn commit -m "another commit" &&
svn up &&
svn mv trunk thunk &&
svn_cmd commit -m "another commit" &&
svn_cmd up &&
svn_cmd mv trunk thunk &&
echo goodbye >> thunk/readme &&
poke thunk/readme &&
svn commit -m "bye now" &&
svn_cmd commit -m "bye now" &&
cd ..
'

Expand Down Expand Up @@ -51,7 +51,7 @@ test_expect_success 'init and fetch from one svn-remote' '
'

test_expect_success 'follow deleted parent' '
(svn cp -m "resurrecting trunk as junk" \
(svn_cmd cp -m "resurrecting trunk as junk" \
"$svnrepo"/trunk@2 "$svnrepo"/junk ||
svn cp -m "resurrecting trunk as junk" \
-r2 "$svnrepo"/trunk "$svnrepo"/junk) &&
Expand Down Expand Up @@ -97,8 +97,8 @@ test_expect_success 'follow higher-level parent' '
'

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 &&
svn_cmd mv -m "bye!" "$svnrepo"/glob/blob/hi "$svnrepo"/glob/blob/bye &&
svn_cmd 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 &&
Expand All @@ -120,7 +120,7 @@ test_expect_success 'follow-parent avoids deleting relevant info' '
cd import &&
svn import -m "r9270 test" . "$svnrepo"/r9270 &&
cd .. &&
svn co "$svnrepo"/r9270/trunk/subversion/bindings/swig/perl r9270 &&
svn_cmd co "$svnrepo"/r9270/trunk/subversion/bindings/swig/perl r9270 &&
cd r9270 &&
svn mkdir native &&
svn mv t native/t &&
Expand All @@ -138,7 +138,7 @@ 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_cmd 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 &&
git svn fetch -i r9270-d &&
Expand All @@ -152,20 +152,20 @@ test_expect_success "track initial change if it was only made to parent" '
test_expect_success "follow-parent is atomic" '
(
cd wc &&
svn up &&
svn mkdir stunk &&
svn_cmd up &&
svn_cmd mkdir stunk &&
echo "trunk stunk" > stunk/readme &&
svn add stunk/readme &&
svn ci -m "trunk stunk" &&
svn_cmd add stunk/readme &&
svn_cmd ci -m "trunk stunk" &&
echo "stunk like junk" >> stunk/readme &&
svn ci -m "really stunk" &&
svn_cmd ci -m "really stunk" &&
echo "stink stank stunk" >> stunk/readme &&
svn ci -m "even the grinch agrees"
svn_cmd ci -m "even the grinch agrees"
) &&
svn copy -m "stunk flunked" "$svnrepo"/stunk "$svnrepo"/flunk &&
svn_cmd copy -m "stunk flunked" "$svnrepo"/stunk "$svnrepo"/flunk &&
{ svn cp -m "early stunk flunked too" \
"$svnrepo"/stunk@17 "$svnrepo"/flunked ||
svn cp -m "early stunk flunked too" \
svn_cmd cp -m "early stunk flunked too" \
-r17 "$svnrepo"/stunk "$svnrepo"/flunked; } &&
git svn init --minimize-url -i stunk "$svnrepo"/stunk &&
git svn fetch -i stunk &&
Expand All @@ -192,7 +192,7 @@ test_expect_success "follow-parent is atomic" '
'

test_expect_success "track multi-parent paths" '
svn cp -m "resurrect /glob" "$svnrepo"/r9270 "$svnrepo"/glob &&
svn_cmd 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
Expand Down
8 changes: 4 additions & 4 deletions t/t9105-git-svn-commit-diff.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ test_expect_success 'initialize repo' '
mkdir import &&
cd import &&
echo hello > readme &&
svn import -m "initial" . "$svnrepo" &&
svn_cmd import -m "initial" . "$svnrepo" &&
cd .. &&
echo hello > readme &&
git update-index --add readme &&
Expand All @@ -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_cmd 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 &&
svn_cmd 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_cmd cat "$svnrepo"/subdir/readme > readme.2 &&
cmp readme readme.2
'

Expand Down
14 changes: 7 additions & 7 deletions t/t9106-git-svn-commit-diff-clobber.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ test_expect_success 'initialize repo' '
mkdir import &&
cd import &&
echo initial > file &&
svn import -m "initial" . "$svnrepo" &&
svn_cmd 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_cmd co "$svnrepo" t.svn &&
cd t.svn &&
echo second line from svn >> file &&
poke file &&
svn commit -m "second line from svn" &&
svn_cmd commit -m "second line from svn" &&
cd .. &&
rm -rf t.svn
'
Expand All @@ -43,11 +43,11 @@ test_expect_success 'dcommit fails to commit because of conflict' '
git svn init "$svnrepo" &&
git svn fetch &&
git reset --hard refs/${remotes_git_svn} &&
svn co "$svnrepo" t.svn &&
svn_cmd co "$svnrepo" t.svn &&
cd t.svn &&
echo fourth line from svn >> file &&
poke file &&
svn commit -m "fourth line from svn" &&
svn_cmd commit -m "fourth line from svn" &&
cd .. &&
rm -rf t.svn &&
echo "fourth line from git" >> file &&
Expand All @@ -67,11 +67,11 @@ 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_cmd co "$svnrepo" t.svn &&
cd t.svn &&
echo third line from svn >> file &&
poke file &&
svn commit -m "third line from svn" &&
svn_cmd commit -m "third line from svn" &&
cd .. &&
rm -rf t.svn
'
Expand Down
2 changes: 1 addition & 1 deletion t/t9107-git-svn-migrate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ test_expect_success 'setup old-looking metadata' '
mkdir -p $i && \
echo hello >> $i/README || exit 1
done && \
svn import -m test . "$svnrepo"
svn_cmd import -m test . "$svnrepo"
cd .. &&
git svn init "$svnrepo" &&
git svn fetch &&
Expand Down
Loading

0 comments on commit da083d6

Please sign in to comment.