summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/lib-git-svn.sh39
-rwxr-xr-xt/t5401-update-hooks.sh81
-rwxr-xr-xt/t9100-git-svn-basic.sh84
-rwxr-xr-xt/t9101-git-svn-props.sh11
-rwxr-xr-xt/t9103-git-svn-graft-branches.sh14
-rwxr-xr-xt/t9104-git-svn-follow-parent.sh1
-rwxr-xr-xt/test-lib.sh6
7 files changed, 143 insertions, 93 deletions
diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh
index 99ada71349..af42ccc8d1 100644
--- a/t/lib-git-svn.sh
+++ b/t/lib-git-svn.sh
@@ -7,26 +7,10 @@ then
exit
fi
-perl -e 'use SVN::Core; $SVN::Core::VERSION gt "1.1.0" or die' >/dev/null 2>&1
-if test $? -ne 0
-then
- test_expect_success 'Perl SVN libraries not found, skipping test' :
- test_done
- exit
-fi
-
GIT_DIR=$PWD/.git
GIT_SVN_DIR=$GIT_DIR/svn/git-svn
SVN_TREE=$GIT_SVN_DIR/svn-tree
-svnadmin >/dev/null 2>&1
-if test $? -ne 1
-then
- test_expect_success 'skipping git-svn tests, svnadmin not found' :
- test_done
- exit
-fi
-
svn >/dev/null 2>&1
if test $? -ne 1
then
@@ -37,13 +21,24 @@ fi
svnrepo=$PWD/svnrepo
-set -e
-
-if svnadmin create --help | grep fs-type >/dev/null
+perl -w -e "
+use SVN::Core;
+use SVN::Repos;
+\$SVN::Core::VERSION gt '1.1.0' or exit(42);
+SVN::Repos::create('$svnrepo', undef, undef, undef,
+ { 'fs-config' => 'fsfs'});
+"
+x=$?
+if test $x -ne 0
then
- svnadmin create --fs-type fsfs "$svnrepo"
-else
- svnadmin create "$svnrepo"
+ if test $x -eq 42; then
+ err='Perl SVN libraries must be >= 1.1.0'
+ else
+ err='Perl SVN libraries not found or unusable, skipping test'
+ fi
+ test_expect_success "$err" :
+ test_done
+ exit
fi
svnrepo="file://$svnrepo"
diff --git a/t/t5401-update-hooks.sh b/t/t5401-update-hooks.sh
new file mode 100755
index 0000000000..cd8cee6ae8
--- /dev/null
+++ b/t/t5401-update-hooks.sh
@@ -0,0 +1,81 @@
+#!/bin/sh
+#
+# Copyright (c) 2006 Shawn O. Pearce
+#
+
+test_description='Test the update hook infrastructure.'
+. ./test-lib.sh
+
+test_expect_success setup '
+ echo This is a test. >a &&
+ git-update-index --add a &&
+ tree0=$(git-write-tree) &&
+ commit0=$(echo setup | git-commit-tree $tree0) &&
+ git-update-ref HEAD $commit0 &&
+ git-clone ./. victim &&
+ echo We hope it works. >a &&
+ git-update-index a &&
+ tree1=$(git-write-tree) &&
+ commit1=$(echo modify | git-commit-tree $tree1 -p $commit0) &&
+ git-update-ref HEAD $commit1
+'
+
+cat >victim/.git/hooks/update <<'EOF'
+#!/bin/sh
+echo "$@" >$GIT_DIR/update.args
+read x; echo -n "$x" >$GIT_DIR/update.stdin
+echo STDOUT update
+echo STDERR update >&2
+EOF
+chmod u+x victim/.git/hooks/update
+
+cat >victim/.git/hooks/post-update <<'EOF'
+#!/bin/sh
+echo "$@" >$GIT_DIR/post-update.args
+read x; echo -n "$x" >$GIT_DIR/post-update.stdin
+echo STDOUT post-update
+echo STDERR post-update >&2
+EOF
+chmod u+x victim/.git/hooks/post-update
+
+test_expect_success push '
+ git-send-pack ./victim/.git/ master >send.out 2>send.err
+'
+
+test_expect_success 'hooks ran' '
+ test -f victim/.git/update.args &&
+ test -f victim/.git/update.stdin &&
+ test -f victim/.git/post-update.args &&
+ test -f victim/.git/post-update.stdin
+'
+
+test_expect_success 'update hook arguments' '
+ echo refs/heads/master $commit0 $commit1 |
+ diff -u - victim/.git/update.args
+'
+
+test_expect_success 'post-update hook arguments' '
+ echo refs/heads/master |
+ diff -u - victim/.git/post-update.args
+'
+
+test_expect_failure 'update hook stdin is /dev/null' '
+ test -s victim/.git/update.stdin
+'
+
+test_expect_failure 'post-update hook stdin is /dev/null' '
+ test -s victim/.git/post-update.stdin
+'
+
+test_expect_failure 'send-pack produced no output' '
+ test -s send.out
+'
+
+test_expect_success 'send-pack stderr contains hook messages' '
+ grep "STDOUT update" send.err &&
+ grep "STDERR update" send.err &&
+ grep "STDOUT post-update" send.err &&
+ grep "STDERR post-update" send.err
+'
+
+test_done
diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh
index c22fe47213..040da92756 100755
--- a/t/t9100-git-svn-basic.sh
+++ b/t/t9100-git-svn-basic.sh
@@ -24,10 +24,7 @@ test_expect_success \
mkdir import &&
cd import &&
echo foo > foo &&
- if test -z '$NO_SYMLINK'
- then
- ln -s foo foo.link
- fi
+ ln -s foo foo.link
mkdir -p dir/a/b/c/d/e &&
echo 'deep dir' > dir/a/b/c/d/e/file &&
mkdir bar &&
@@ -136,48 +133,43 @@ test_expect_success "$name" "
test -x '$SVN_TREE'/exec.sh"
-if test -z "$NO_SYMLINK"
-then
- name='executable file becomes a symlink to bar/zzz (file)'
-
- test_expect_success "$name" "
- rm exec.sh &&
- ln -s bar/zzz exec.sh &&
- git update-index exec.sh &&
- git commit -m '$name' &&
- git-svn set-tree --find-copies-harder --rmdir \
- remotes/git-svn..mybranch5 &&
- svn up '$SVN_TREE' &&
- test -L '$SVN_TREE'/exec.sh"
+name='executable file becomes a symlink to bar/zzz (file)'
+test_expect_success "$name" "
+ rm exec.sh &&
+ ln -s bar/zzz exec.sh &&
+ git update-index exec.sh &&
+ git commit -m '$name' &&
+ git-svn set-tree --find-copies-harder --rmdir \
+ remotes/git-svn..mybranch5 &&
+ svn up '$SVN_TREE' &&
+ test -L '$SVN_TREE'/exec.sh"
- name='new symlink is added to a file that was also just made executable'
+name='new symlink is added to a file that was also just made executable'
- test_expect_success "$name" "
- chmod +x bar/zzz &&
- ln -s bar/zzz exec-2.sh &&
- git update-index --add bar/zzz exec-2.sh &&
- git commit -m '$name' &&
- git-svn set-tree --find-copies-harder --rmdir \
- remotes/git-svn..mybranch5 &&
- svn up '$SVN_TREE' &&
- test -x '$SVN_TREE'/bar/zzz &&
- test -L '$SVN_TREE'/exec-2.sh"
-
- name='modify a symlink to become a file'
- test_expect_success "$name" "
- echo git help > help || true &&
- rm exec-2.sh &&
- cp help exec-2.sh &&
- git update-index exec-2.sh &&
- git commit -m '$name' &&
- git-svn set-tree --find-copies-harder --rmdir \
- remotes/git-svn..mybranch5 &&
- svn up '$SVN_TREE' &&
- test -f '$SVN_TREE'/exec-2.sh &&
- test ! -L '$SVN_TREE'/exec-2.sh &&
- diff -u help $SVN_TREE/exec-2.sh"
-fi
+test_expect_success "$name" "
+ chmod +x bar/zzz &&
+ ln -s bar/zzz exec-2.sh &&
+ git update-index --add bar/zzz exec-2.sh &&
+ git commit -m '$name' &&
+ git-svn set-tree --find-copies-harder --rmdir \
+ remotes/git-svn..mybranch5 &&
+ svn up '$SVN_TREE' &&
+ test -x '$SVN_TREE'/bar/zzz &&
+ test -L '$SVN_TREE'/exec-2.sh"
+name='modify a symlink to become a file'
+test_expect_success "$name" "
+ echo git help > help || true &&
+ rm exec-2.sh &&
+ cp help exec-2.sh &&
+ git update-index exec-2.sh &&
+ git commit -m '$name' &&
+ git-svn set-tree --find-copies-harder --rmdir \
+ remotes/git-svn..mybranch5 &&
+ svn up '$SVN_TREE' &&
+ test -f '$SVN_TREE'/exec-2.sh &&
+ test ! -L '$SVN_TREE'/exec-2.sh &&
+ diff -u help $SVN_TREE/exec-2.sh"
if test "$have_utf8" = t
then
@@ -203,12 +195,6 @@ test_expect_success "$name" \
git-rev-list --pretty=raw remotes/alt | grep ^tree | uniq > b &&
diff -u a b"
-if test -n "$NO_SYMLINK"
-then
- test_done
- exit 0
-fi
-
name='check imported tree checksums expected tree checksums'
rm -f expected
if test "$have_utf8" = t
diff --git a/t/t9101-git-svn-props.sh b/t/t9101-git-svn-props.sh
index 5543b07f16..46fcec50a5 100755
--- a/t/t9101-git-svn-props.sh
+++ b/t/t9101-git-svn-props.sh
@@ -57,13 +57,10 @@ test_expect_success 'setup some commits to svn' \
'cd test_wc &&
echo Greetings >> kw.c &&
svn commit -m "Not yet an Id" &&
- svn up &&
echo Hello world >> kw.c &&
svn commit -m "Modified file, but still not yet an Id" &&
- svn up &&
svn propset svn:keywords Id kw.c &&
- svn commit -m "Propset Id" &&
- svn up &&
+ svn commit -m "Propset Id"
cd ..'
test_expect_success 'initialize git-svn' "git-svn init $svnrepo"
@@ -86,8 +83,7 @@ test_expect_success "propset CR on crlf files" \
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 up &&
+ svn commit -m "propset CR on crlf files"
cd ..'
test_expect_success 'fetch and pull latest from svn and checkout a new wc' \
@@ -111,8 +107,7 @@ cd test_wc
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 up'
+ svn 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'
diff --git a/t/t9103-git-svn-graft-branches.sh b/t/t9103-git-svn-graft-branches.sh
index 293b98f928..b5f7677021 100755
--- a/t/t9103-git-svn-graft-branches.sh
+++ b/t/t9103-git-svn-graft-branches.sh
@@ -16,25 +16,19 @@ test_expect_success 'initialize repo' "
cd wc &&
echo feedme >> branches/a/readme &&
svn commit -m hungry &&
- svn up &&
cd trunk &&
svn merge -r3:4 $svnrepo/branches/a &&
svn commit -m 'merge with a' &&
cd ../.. &&
- svn log -v $svnrepo &&
- git-svn init -i trunk $svnrepo/trunk &&
- git-svn init -i a $svnrepo/branches/a &&
- git-svn init -i tags/a $svnrepo/tags/a &&
- git-svn fetch -i tags/a &&
- git-svn fetch -i a &&
- git-svn fetch -i trunk
+ git-svn multi-init $svnrepo -T trunk -b branches -t tags &&
+ git-svn multi-fetch
"
r1=`git-rev-list remotes/trunk | tail -n1`
r2=`git-rev-list remotes/tags/a | tail -n1`
r3=`git-rev-list remotes/a | tail -n1`
-r4=`git-rev-list remotes/a | head -n1`
-r5=`git-rev-list remotes/trunk | head -n1`
+r4=`git-rev-parse remotes/a`
+r5=`git-rev-parse remotes/trunk`
test_expect_success 'test graft-branches regexes and copies' "
test -n "$r1" &&
diff --git a/t/t9104-git-svn-follow-parent.sh b/t/t9104-git-svn-follow-parent.sh
index 8d2e2fec39..400c21cd49 100755
--- a/t/t9104-git-svn-follow-parent.sh
+++ b/t/t9104-git-svn-follow-parent.sh
@@ -17,7 +17,6 @@ test_expect_success 'initialize repo' "
cd wc &&
echo world >> trunk/readme &&
svn commit -m 'another commit' &&
- svn up &&
svn mv -m 'rename to thunk' trunk thunk &&
svn up &&
echo goodbye >> thunk/readme &&
diff --git a/t/test-lib.sh b/t/test-lib.sh
index bf108d4226..72ea2b2598 100755
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -99,12 +99,12 @@ trap 'echo >&5 "FATAL: Unexpected exit with code $?"; exit 1' exit
test_tick () {
if test -z "${test_tick+set}"
then
- test_tick=432630000
+ test_tick=1112911993
else
test_tick=$(($test_tick + 60))
fi
- GIT_COMMITTER_DATE=$test_tick
- GIT_AUTHOR_DATE=$test_tick
+ GIT_COMMITTER_DATE="$test_tick -0700"
+ GIT_AUTHOR_DATE="$test_tick -0700"
export GIT_COMMITTER_DATE GIT_AUTHOR_DATE
}