3 # Copyright (c) 2009 Eric Wong, Mark Lodato
6 test_description='git svn authors prog tests'
10 write_script svn-authors-prog "$PERL_PATH" <<-\EOF
15 print "$_ <$_\@sub.example.com>\n";
17 print "$_ <$_\@example.com>\n";
21 test_expect_success 'svn-authors setup' '
22 cat >svn-authors <<-\EOF
23 ff = FFFFFFF FFFFFFF <fFf@other.example.com>
27 test_expect_success 'setup svnrepo' '
28 for i in aa bb cc-sub dd-sub ee-foo ff
30 svn mkdir -m $i --username $i "$svnrepo"/$i
34 test_expect_success 'import authors with prog and file' '
35 git svn clone --authors-prog=./svn-authors-prog \
36 --authors-file=svn-authors "$svnrepo" x
39 test_expect_success 'imported 6 revisions successfully' '
42 test "$(git rev-list refs/remotes/git-svn | wc -l)" -eq 6
46 test_expect_success 'authors-prog ran correctly' '
49 git rev-list -1 --pretty=raw refs/remotes/git-svn~1 | \
50 grep "^author ee-foo <ee-foo@example\.com> " &&
51 git rev-list -1 --pretty=raw refs/remotes/git-svn~2 | \
52 grep "^author dd <dd@sub\.example\.com> " &&
53 git rev-list -1 --pretty=raw refs/remotes/git-svn~3 | \
54 grep "^author cc <cc@sub\.example\.com> " &&
55 git rev-list -1 --pretty=raw refs/remotes/git-svn~4 | \
56 grep "^author bb <bb@example\.com> " &&
57 git rev-list -1 --pretty=raw refs/remotes/git-svn~5 | \
58 grep "^author aa <aa@example\.com> "
62 test_expect_success 'authors-file overrode authors-prog' '
65 git rev-list -1 --pretty=raw refs/remotes/git-svn | \
66 grep "^author FFFFFFF FFFFFFF <fFf@other\.example\.com> "
70 git --git-dir=x/.git config --unset svn.authorsfile
71 git --git-dir=x/.git config --unset svn.authorsprog
73 test_expect_success 'authors-prog imported user without email' '
74 svn mkdir -m gg --username gg-hermit "$svnrepo"/gg &&
77 git svn fetch --authors-prog=../svn-authors-prog &&
78 git rev-list -1 --pretty=raw refs/remotes/git-svn | \
83 test_expect_success 'imported without authors-prog and authors-file' '
84 svn mkdir -m hh --username hh "$svnrepo"/hh &&
86 uuid=$(svn info "$svnrepo" |
87 sed -n "s/^Repository UUID: //p") &&
90 git rev-list -1 --pretty=raw refs/remotes/git-svn | \
91 grep "^author hh <hh@$uuid> "
95 test_expect_success 'authors-prog handled special characters in username' '
96 svn mkdir -m bad --username "xyz; touch evil" "$svnrepo"/bad &&
99 git svn --authors-prog=../svn-authors-prog fetch &&
100 git rev-list -1 --pretty=raw refs/remotes/git-svn |
101 grep "^author xyz; touch evil <xyz; touch evil@example\.com> " &&