2009-01-11 23:44:07 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Copyright (c) 2008 Eric Wong
|
|
|
|
#
|
|
|
|
|
|
|
|
test_description='git svn authors file tests'
|
|
|
|
|
|
|
|
. ./lib-git-svn.sh
|
|
|
|
|
|
|
|
cat > svn-authors <<EOF
|
|
|
|
aa = AAAAAAA AAAAAAA <aa@example.com>
|
|
|
|
bb = BBBBBBB BBBBBBB <bb@example.com>
|
|
|
|
EOF
|
|
|
|
|
|
|
|
test_expect_success 'setup svnrepo' '
|
|
|
|
for i in aa bb cc dd
|
|
|
|
do
|
2009-05-08 08:06:16 +00:00
|
|
|
svn_cmd mkdir -m $i --username $i "$svnrepo"/$i
|
2009-01-11 23:44:07 +00:00
|
|
|
done
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'start import with incomplete authors file' '
|
2010-07-20 23:18:34 +00:00
|
|
|
test_must_fail git svn clone --authors-file=svn-authors "$svnrepo" x
|
2009-01-11 23:44:07 +00:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'imported 2 revisions successfully' '
|
|
|
|
(
|
|
|
|
cd x
|
|
|
|
test "`git rev-list refs/remotes/git-svn | wc -l`" -eq 2 &&
|
|
|
|
git rev-list -1 --pretty=raw refs/remotes/git-svn | \
|
|
|
|
grep "^author BBBBBBB BBBBBBB <bb@example\.com> " &&
|
|
|
|
git rev-list -1 --pretty=raw refs/remotes/git-svn~1 | \
|
|
|
|
grep "^author AAAAAAA AAAAAAA <aa@example\.com> "
|
|
|
|
)
|
|
|
|
'
|
|
|
|
|
|
|
|
cat >> svn-authors <<EOF
|
|
|
|
cc = CCCCCCC CCCCCCC <cc@example.com>
|
|
|
|
dd = DDDDDDD DDDDDDD <dd@example.com>
|
|
|
|
EOF
|
|
|
|
|
|
|
|
test_expect_success 'continues to import once authors have been added' '
|
|
|
|
(
|
|
|
|
cd x
|
|
|
|
git svn fetch --authors-file=../svn-authors &&
|
|
|
|
test "`git rev-list refs/remotes/git-svn | wc -l`" -eq 4 &&
|
|
|
|
git rev-list -1 --pretty=raw refs/remotes/git-svn | \
|
|
|
|
grep "^author DDDDDDD DDDDDDD <dd@example\.com> " &&
|
|
|
|
git rev-list -1 --pretty=raw refs/remotes/git-svn~1 | \
|
|
|
|
grep "^author CCCCCCC CCCCCCC <cc@example\.com> "
|
|
|
|
)
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'authors-file against globs' '
|
2009-05-08 08:06:16 +00:00
|
|
|
svn_cmd mkdir -m globs --username aa \
|
2009-01-11 23:44:07 +00:00
|
|
|
"$svnrepo"/aa/trunk "$svnrepo"/aa/branches "$svnrepo"/aa/tags &&
|
|
|
|
git svn clone --authors-file=svn-authors -s "$svnrepo"/aa aa-work &&
|
|
|
|
for i in bb ee cc
|
|
|
|
do
|
|
|
|
branch="aa/branches/$i"
|
2009-05-08 08:06:16 +00:00
|
|
|
svn_cmd mkdir -m "$branch" --username $i "$svnrepo/$branch"
|
2009-01-11 23:44:07 +00:00
|
|
|
done
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'fetch fails on ee' '
|
2010-07-20 23:18:34 +00:00
|
|
|
( cd aa-work && test_must_fail git svn fetch --authors-file=../svn-authors )
|
2009-01-11 23:44:07 +00:00
|
|
|
'
|
|
|
|
|
|
|
|
tmp_config_get () {
|
2014-03-20 23:17:01 +00:00
|
|
|
git config --file=.git/svn/.metadata --get "$1"
|
2009-01-11 23:44:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
test_expect_success 'failure happened without negative side effects' '
|
|
|
|
(
|
|
|
|
cd aa-work &&
|
|
|
|
test 6 -eq "`tmp_config_get svn-remote.svn.branches-maxRev`" &&
|
|
|
|
test 6 -eq "`tmp_config_get svn-remote.svn.tags-maxRev`"
|
|
|
|
)
|
|
|
|
'
|
|
|
|
|
|
|
|
cat >> svn-authors <<EOF
|
|
|
|
ee = EEEEEEE EEEEEEE <ee@example.com>
|
|
|
|
EOF
|
|
|
|
|
|
|
|
test_expect_success 'fetch continues after authors-file is fixed' '
|
|
|
|
(
|
|
|
|
cd aa-work &&
|
|
|
|
git svn fetch --authors-file=../svn-authors &&
|
|
|
|
test 8 -eq "`tmp_config_get svn-remote.svn.branches-maxRev`" &&
|
|
|
|
test 8 -eq "`tmp_config_get svn-remote.svn.tags-maxRev`"
|
|
|
|
)
|
|
|
|
'
|
|
|
|
|
2009-11-14 22:43:20 +00:00
|
|
|
test_expect_success 'fresh clone with svn.authors-file in config' '
|
|
|
|
(
|
|
|
|
rm -r "$GIT_DIR" &&
|
|
|
|
test x = x"$(git config svn.authorsfile)" &&
|
|
|
|
test_config="$HOME"/.gitconfig &&
|
2012-02-12 01:05:12 +00:00
|
|
|
sane_unset GIT_DIR &&
|
2009-11-14 22:43:20 +00:00
|
|
|
git config --global \
|
|
|
|
svn.authorsfile "$HOME"/svn-authors &&
|
|
|
|
test x"$HOME"/svn-authors = x"$(git config svn.authorsfile)" &&
|
|
|
|
git svn clone "$svnrepo" gitconfig.clone &&
|
|
|
|
cd gitconfig.clone &&
|
|
|
|
nr_ex=$(git log | grep "^Author:.*example.com" | wc -l) &&
|
|
|
|
nr_rev=$(git rev-list HEAD | wc -l) &&
|
|
|
|
test $nr_rev -eq $nr_ex
|
|
|
|
)
|
|
|
|
'
|
|
|
|
|
|
|
|
test_debug 'GIT_DIR=gitconfig.clone/.git git log'
|
|
|
|
|
2009-01-11 23:44:07 +00:00
|
|
|
test_done
|