Avoid doing extra 'lstat()'s for d_type if we have an up-to-date cache entry
[git/dscho.git] / t / t9138-git-svn-authors-prog.sh
bloba4b00f2a3fcecab62aaabeedd0821e38f179019a
1 #!/bin/sh
3 # Copyright (c) 2009 Eric Wong, Mark Lodato
6 test_description='git svn authors prog tests'
8 . ./lib-git-svn.sh
10 cat > svn-authors-prog <<'EOF'
11 #!/usr/bin/perl
12 $_ = shift;
13 if (s/-sub$//) {
14 print "$_ <$_\@sub.example.com>\n";
16 else {
17 print "$_ <$_\@example.com>\n";
19 EOF
20 chmod +x svn-authors-prog
22 cat > svn-authors <<'EOF'
23 ff = FFFFFFF FFFFFFF <fFf@other.example.com>
24 EOF
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
30 done
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' '
40 cd x
41 test "`git rev-list refs/remotes/git-svn | wc -l`" -eq 6
45 test_expect_success 'authors-prog ran correctly' '
47 cd x
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' '
63 cd x
64 git rev-list -1 --pretty=raw refs/remotes/git-svn | \
65 grep "^author FFFFFFF FFFFFFF <fFf@other\.example\.com> "
69 test_done