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 || return 1
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 git rev-list refs/remotes/git-svn >actual &&
43 test_line_count = 6 actual
47 test_expect_success 'authors-prog ran correctly' '
50 git rev-list -1 --pretty=raw refs/remotes/git-svn~1 >actual &&
51 grep "^author ee-foo <ee-foo@example\.com> " actual &&
52 git rev-list -1 --pretty=raw refs/remotes/git-svn~2 >actual &&
53 grep "^author dd <dd@sub\.example\.com> " actual &&
54 git rev-list -1 --pretty=raw refs/remotes/git-svn~3 >actual &&
55 grep "^author cc <cc@sub\.example\.com> " actual &&
56 git rev-list -1 --pretty=raw refs/remotes/git-svn~4 >actual &&
57 grep "^author bb <bb@example\.com> " actual &&
58 git rev-list -1 --pretty=raw refs/remotes/git-svn~5 >actual &&
59 grep "^author aa <aa@example\.com> " actual
63 test_expect_success 'authors-file overrode authors-prog' '
66 git rev-list -1 --pretty=raw refs/remotes/git-svn >actual &&
67 grep "^author FFFFFFF FFFFFFF <fFf@other\.example\.com> " actual
71 git --git-dir=x/.git config --unset svn.authorsfile
72 git --git-dir=x/.git config --unset svn.authorsprog
74 test_expect_success 'authors-prog imported user without email' '
75 svn mkdir -m gg --username gg-hermit "$svnrepo"/gg &&
78 git svn fetch --authors-prog=../svn-authors-prog &&
79 git rev-list -1 --pretty=raw refs/remotes/git-svn | \
84 test_expect_success 'imported without authors-prog and authors-file' '
85 svn mkdir -m hh --username hh "$svnrepo"/hh &&
87 uuid=$(svn info "$svnrepo" |
88 sed -n "s/^Repository UUID: //p") &&
91 git rev-list -1 --pretty=raw refs/remotes/git-svn | \
92 grep "^author hh <hh@$uuid> "
96 test_expect_success 'authors-prog handled special characters in username' '
97 svn mkdir -m bad --username "xyz; touch evil" "$svnrepo"/bad &&
100 git svn --authors-prog=../svn-authors-prog fetch &&
101 git rev-list -1 --pretty=raw refs/remotes/git-svn >actual &&
102 grep "^author xyz; touch evil <xyz; touch evil@example\.com> " actual &&