2009-05-15 05:27:15 +04:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Copyright (c) 2009 Eric Wong, Mark Lodato
|
|
|
|
#
|
|
|
|
|
|
|
|
test_description='git svn authors prog tests'
|
|
|
|
|
|
|
|
. ./lib-git-svn.sh
|
|
|
|
|
2014-05-25 23:24:54 +04:00
|
|
|
write_script svn-authors-prog "$PERL_PATH" <<-\EOF
|
|
|
|
$_ = shift;
|
|
|
|
if (s/-sub$//) {
|
|
|
|
print "$_ <$_\@sub.example.com>\n";
|
|
|
|
} else {
|
|
|
|
print "$_ <$_\@example.com>\n";
|
|
|
|
}
|
2009-05-15 05:27:15 +04:00
|
|
|
EOF
|
|
|
|
|
2014-05-25 23:24:54 +04:00
|
|
|
test_expect_success 'svn-authors setup' '
|
|
|
|
cat >svn-authors <<-\EOF
|
|
|
|
ff = FFFFFFF FFFFFFF <fFf@other.example.com>
|
|
|
|
EOF
|
|
|
|
'
|
2009-05-15 05:27:15 +04:00
|
|
|
|
|
|
|
test_expect_success 'setup svnrepo' '
|
|
|
|
for i in aa bb cc-sub dd-sub ee-foo ff
|
|
|
|
do
|
|
|
|
svn mkdir -m $i --username $i "$svnrepo"/$i
|
|
|
|
done
|
2014-05-25 23:24:54 +04:00
|
|
|
'
|
2009-05-15 05:27:15 +04:00
|
|
|
|
|
|
|
test_expect_success 'import authors with prog and file' '
|
|
|
|
git svn clone --authors-prog=./svn-authors-prog \
|
|
|
|
--authors-file=svn-authors "$svnrepo" x
|
2014-05-25 23:24:54 +04:00
|
|
|
'
|
2009-05-15 05:27:15 +04:00
|
|
|
|
|
|
|
test_expect_success 'imported 6 revisions successfully' '
|
|
|
|
(
|
|
|
|
cd x
|
2016-01-12 14:49:32 +03:00
|
|
|
test "$(git rev-list refs/remotes/git-svn | wc -l)" -eq 6
|
2009-05-15 05:27:15 +04:00
|
|
|
)
|
2014-05-25 23:24:54 +04:00
|
|
|
'
|
2009-05-15 05:27:15 +04:00
|
|
|
|
|
|
|
test_expect_success 'authors-prog ran correctly' '
|
|
|
|
(
|
|
|
|
cd x
|
|
|
|
git rev-list -1 --pretty=raw refs/remotes/git-svn~1 | \
|
|
|
|
grep "^author ee-foo <ee-foo@example\.com> " &&
|
|
|
|
git rev-list -1 --pretty=raw refs/remotes/git-svn~2 | \
|
|
|
|
grep "^author dd <dd@sub\.example\.com> " &&
|
|
|
|
git rev-list -1 --pretty=raw refs/remotes/git-svn~3 | \
|
|
|
|
grep "^author cc <cc@sub\.example\.com> " &&
|
|
|
|
git rev-list -1 --pretty=raw refs/remotes/git-svn~4 | \
|
|
|
|
grep "^author bb <bb@example\.com> " &&
|
|
|
|
git rev-list -1 --pretty=raw refs/remotes/git-svn~5 | \
|
|
|
|
grep "^author aa <aa@example\.com> "
|
|
|
|
)
|
2014-05-25 23:24:54 +04:00
|
|
|
'
|
2009-05-15 05:27:15 +04:00
|
|
|
|
|
|
|
test_expect_success 'authors-file overrode authors-prog' '
|
|
|
|
(
|
|
|
|
cd x
|
|
|
|
git rev-list -1 --pretty=raw refs/remotes/git-svn | \
|
|
|
|
grep "^author FFFFFFF FFFFFFF <fFf@other\.example\.com> "
|
|
|
|
)
|
2014-05-25 23:24:54 +04:00
|
|
|
'
|
2009-05-15 05:27:15 +04:00
|
|
|
|
2009-09-13 04:33:23 +04:00
|
|
|
git --git-dir=x/.git config --unset svn.authorsfile
|
|
|
|
git --git-dir=x/.git config --unset svn.authorsprog
|
|
|
|
|
|
|
|
test_expect_success 'authors-prog handled special characters in username' '
|
|
|
|
svn mkdir -m bad --username "xyz; touch evil" "$svnrepo"/bad &&
|
|
|
|
(
|
|
|
|
cd x &&
|
|
|
|
git svn --authors-prog=../svn-authors-prog fetch &&
|
|
|
|
git rev-list -1 --pretty=raw refs/remotes/git-svn |
|
|
|
|
grep "^author xyz; touch evil <xyz; touch evil@example\.com> " &&
|
|
|
|
! test -f evil
|
|
|
|
)
|
|
|
|
'
|
|
|
|
|
2009-05-15 05:27:15 +04:00
|
|
|
test_done
|