Merge branch 'en/t7405-recursive-submodule-conflicts'
[gitweb.git] / t / t9138-git-svn-authors-prog.sh
index 48109f949f27082ddb1acf8255d70c72d3eea521..027b416720ddf774ffd52e9bd3267b009bd70899 100755 (executable)
@@ -9,7 +9,9 @@ test_description='git svn authors prog tests'
 
 write_script svn-authors-prog "$PERL_PATH" <<-\EOF
        $_ = shift;
-       if (s/-sub$//)  {
+       if (s/-hermit//) {
+               print "$_ <>\n";
+       } elsif (s/-sub$//)  {
                print "$_ <$_\@sub.example.com>\n";
        } else {
                print "$_ <$_\@example.com>\n";
@@ -36,7 +38,7 @@ test_expect_success 'import authors with prog and file' '
 
 test_expect_success 'imported 6 revisions successfully' '
        (
-               cd x
+               cd x &&
                git rev-list refs/remotes/git-svn >actual &&
                test_line_count = 6 actual
        )
@@ -44,7 +46,7 @@ test_expect_success 'imported 6 revisions successfully' '
 
 test_expect_success 'authors-prog ran correctly' '
        (
-               cd x
+               cd x &&
                git rev-list -1 --pretty=raw refs/remotes/git-svn~1 >actual &&
                grep "^author ee-foo <ee-foo@example\.com> " actual &&
                git rev-list -1 --pretty=raw refs/remotes/git-svn~2 >actual &&
@@ -60,7 +62,7 @@ test_expect_success 'authors-prog ran correctly' '
 
 test_expect_success 'authors-file overrode authors-prog' '
        (
-               cd x
+               cd x &&
                git rev-list -1 --pretty=raw refs/remotes/git-svn >actual &&
                grep "^author FFFFFFF FFFFFFF <fFf@other\.example\.com> " actual
        )
@@ -69,6 +71,28 @@ test_expect_success 'authors-file overrode authors-prog' '
 git --git-dir=x/.git config --unset svn.authorsfile
 git --git-dir=x/.git config --unset svn.authorsprog
 
+test_expect_success 'authors-prog imported user without email' '
+       svn mkdir -m gg --username gg-hermit "$svnrepo"/gg &&
+       (
+               cd x &&
+               git svn fetch --authors-prog=../svn-authors-prog &&
+               git rev-list -1 --pretty=raw refs/remotes/git-svn | \
+                 grep "^author gg <> "
+       )
+'
+
+test_expect_success 'imported without authors-prog and authors-file' '
+       svn mkdir -m hh --username hh "$svnrepo"/hh &&
+       (
+               uuid=$(svn info "$svnrepo" |
+                       sed -n "s/^Repository UUID: //p") &&
+               cd x &&
+               git svn fetch &&
+               git rev-list -1 --pretty=raw refs/remotes/git-svn | \
+                 grep "^author hh <hh@$uuid> "
+       )
+'
+
 test_expect_success 'authors-prog handled special characters in username' '
        svn mkdir -m bad --username "xyz; touch evil" "$svnrepo"/bad &&
        (