3 # Copyright (c) 2009 Eric Wong, Mark Lodato
6 test_description
='git svn authors prog tests'
10 cat > svn-authors-prog
<<'EOF'
14 print "$_ <$_\@sub.example.com>\n";
17 print "$_ <$_\@example.com>\n";
20 chmod +x svn-authors-prog
22 cat > svn-authors
<<'EOF'
23 ff = FFFFFFF FFFFFFF <fFf@other.example.com>
26 test_expect_success
'setup svnrepo' '
27 for i in aa bb cc-sub dd-sub ee-foo ff
29 svn mkdir -m $i --username $i "$svnrepo"/$i
33 test_expect_success
'import authors with prog and file' '
34 git svn clone --authors-prog=./svn-authors-prog \
35 --authors-file=svn-authors "$svnrepo" x
38 test_expect_success
'imported 6 revisions successfully' '
41 test "`git rev-list refs/remotes/git-svn | wc -l`" -eq 6
45 test_expect_success
'authors-prog ran correctly' '
48 git rev-list -1 --pretty=raw refs/remotes/git-svn~1 | \
49 grep "^author ee-foo <ee-foo@example\.com> " &&
50 git rev-list -1 --pretty=raw refs/remotes/git-svn~2 | \
51 grep "^author dd <dd@sub\.example\.com> " &&
52 git rev-list -1 --pretty=raw refs/remotes/git-svn~3 | \
53 grep "^author cc <cc@sub\.example\.com> " &&
54 git rev-list -1 --pretty=raw refs/remotes/git-svn~4 | \
55 grep "^author bb <bb@example\.com> " &&
56 git rev-list -1 --pretty=raw refs/remotes/git-svn~5 | \
57 grep "^author aa <aa@example\.com> "
61 test_expect_success
'authors-file overrode authors-prog' '
64 git rev-list -1 --pretty=raw refs/remotes/git-svn | \
65 grep "^author FFFFFFF FFFFFFF <fFf@other\.example\.com> "
69 git
--git-dir=x
/.git config
--unset svn.authorsfile
70 git
--git-dir=x
/.git config
--unset svn.authorsprog
72 test_expect_success
'authors-prog handled special characters in username' '
73 svn mkdir -m bad --username "xyz; touch evil" "$svnrepo"/bad &&
76 git svn --authors-prog=../svn-authors-prog fetch &&
77 git rev-list -1 --pretty=raw refs/remotes/git-svn |
78 grep "^author xyz; touch evil <xyz; touch evil@example\.com> " &&