Merge branch 'svn/authors-prog-2' of git://bogomips.org/git-svn
authorJunio C Hamano <gitster@pobox.com>
Wed, 11 Apr 2018 23:05:28 +0000 (08:05 +0900)
committerJunio C Hamano <gitster@pobox.com>
Wed, 11 Apr 2018 23:05:28 +0000 (08:05 +0900)
* 'svn/authors-prog-2' of git://bogomips.org/git-svn:
git-svn: allow empty email-address using authors-prog and authors-file
git-svn: search --authors-prog in PATH too

1  2 
t/t9130-git-svn-authors-file.sh
t/t9138-git-svn-authors-prog.sh
index 7752a1faeb0cc9e96b318af37d24b79a545a9b3c,6af6daf461493c1ac9cd0a60982cdc52209ab45b..d8262854bbee335aec293b8f75b9979e60b91171
@@@ -26,12 -26,11 +26,12 @@@ test_expect_success 'start import with 
  test_expect_success 'imported 2 revisions successfully' '
        (
                cd x
 -              test "$(git rev-list refs/remotes/git-svn | wc -l)" -eq 2 &&
 -              git rev-list -1 --pretty=raw refs/remotes/git-svn | \
 -                grep "^author BBBBBBB BBBBBBB <bb@example\.com> " &&
 -              git rev-list -1 --pretty=raw refs/remotes/git-svn~1 | \
 -                grep "^author AAAAAAA AAAAAAA <aa@example\.com> "
 +              git rev-list refs/remotes/git-svn >actual &&
 +              test_line_count = 2 actual &&
 +              git rev-list -1 --pretty=raw refs/remotes/git-svn >actual &&
 +              grep "^author BBBBBBB BBBBBBB <bb@example\.com> " actual &&
 +              git rev-list -1 --pretty=raw refs/remotes/git-svn~1 >actual &&
 +              grep "^author AAAAAAA AAAAAAA <aa@example\.com> " actual
        )
        '
  
@@@ -44,12 -43,11 +44,12 @@@ test_expect_success 'continues to impor
        (
                cd x
                git svn fetch --authors-file=../svn-authors &&
 -              test "$(git rev-list refs/remotes/git-svn | wc -l)" -eq 4 &&
 -              git rev-list -1 --pretty=raw refs/remotes/git-svn | \
 -                grep "^author DDDDDDD DDDDDDD <dd@example\.com> " &&
 -              git rev-list -1 --pretty=raw refs/remotes/git-svn~1 | \
 -                grep "^author CCCCCCC CCCCCCC <cc@example\.com> "
 +              git rev-list refs/remotes/git-svn >actual &&
 +              test_line_count = 4 actual &&
 +              git rev-list -1 --pretty=raw refs/remotes/git-svn >actual &&
 +              grep "^author DDDDDDD DDDDDDD <dd@example\.com> " actual &&
 +              git rev-list -1 --pretty=raw refs/remotes/git-svn~1 >actual &&
 +              grep "^author CCCCCCC CCCCCCC <cc@example\.com> " actual
        )
        '
  
@@@ -104,14 -102,26 +104,28 @@@ test_expect_success !MINGW 'fresh clon
                test x"$HOME"/svn-authors = x"$(git config svn.authorsfile)" &&
                git svn clone "$svnrepo" gitconfig.clone &&
                cd gitconfig.clone &&
 -              nr_ex=$(git log | grep "^Author:.*example.com" | wc -l) &&
 -              nr_rev=$(git rev-list HEAD | wc -l) &&
 +              git log >actual &&
 +              nr_ex=$(grep "^Author:.*example.com" actual | wc -l) &&
 +              git rev-list HEAD >actual &&
 +              nr_rev=$(wc -l <actual) &&
                test $nr_rev -eq $nr_ex
        )
  '
  
+ cat >> svn-authors <<EOF
+ ff = FFFFFFF FFFFFFF <>
+ EOF
+ test_expect_success 'authors-file imported user without email' '
+       svn_cmd mkdir -m aa/branches/ff --username ff "$svnrepo/aa/branches/ff" &&
+       (
+               cd aa-work &&
+               git svn fetch --authors-file=../svn-authors &&
+               git rev-list -1 --pretty=raw refs/remotes/origin/ff | \
+                 grep "^author FFFFFFF FFFFFFF <> "
+       )
+       '
  test_debug 'GIT_DIR=gitconfig.clone/.git git log'
  
  test_done
index 48109f949f27082ddb1acf8255d70c72d3eea521,e94d2a684a7a75c988b967aeef356df6fda42fb1..93ef44fae8f28149344b9125530807ed49727e68
@@@ -9,7 -9,9 +9,9 @@@ test_description='git svn authors prog 
  
  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";
@@@ -37,45 -39,66 +39,67 @@@ test_expect_success 'import authors wit
  test_expect_success 'imported 6 revisions successfully' '
        (
                cd x
 -              test "$(git rev-list refs/remotes/git-svn | wc -l)" -eq 6
 +              git rev-list refs/remotes/git-svn >actual &&
 +              test_line_count = 6 actual
        )
  '
  
  test_expect_success 'authors-prog ran correctly' '
        (
                cd x
 -              git rev-list -1 --pretty=raw refs/remotes/git-svn~1 | \
 -                grep "^author ee-foo <ee-foo@example\.com> " &&
 -              git rev-list -1 --pretty=raw refs/remotes/git-svn~2 | \
 -                grep "^author dd <dd@sub\.example\.com> " &&
 -              git rev-list -1 --pretty=raw refs/remotes/git-svn~3 | \
 -                grep "^author cc <cc@sub\.example\.com> " &&
 -              git rev-list -1 --pretty=raw refs/remotes/git-svn~4 | \
 -                grep "^author bb <bb@example\.com> " &&
 -              git rev-list -1 --pretty=raw refs/remotes/git-svn~5 | \
 -                grep "^author aa <aa@example\.com> "
 +              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 &&
 +              grep "^author dd <dd@sub\.example\.com> " actual &&
 +              git rev-list -1 --pretty=raw refs/remotes/git-svn~3 >actual &&
 +              grep "^author cc <cc@sub\.example\.com> " actual &&
 +              git rev-list -1 --pretty=raw refs/remotes/git-svn~4 >actual &&
 +              grep "^author bb <bb@example\.com> " actual &&
 +              git rev-list -1 --pretty=raw refs/remotes/git-svn~5 >actual &&
 +              grep "^author aa <aa@example\.com> " actual
        )
  '
  
  test_expect_success 'authors-file overrode authors-prog' '
        (
                cd x
 -              git rev-list -1 --pretty=raw refs/remotes/git-svn | \
 -                grep "^author FFFFFFF FFFFFFF <fFf@other\.example\.com> "
 +              git rev-list -1 --pretty=raw refs/remotes/git-svn >actual &&
 +              grep "^author FFFFFFF FFFFFFF <fFf@other\.example\.com> " actual
        )
  '
  
  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 &&
        (
                cd x &&
                git svn --authors-prog=../svn-authors-prog fetch &&
 -              git rev-list -1 --pretty=raw refs/remotes/git-svn |
 -              grep "^author xyz; touch evil <xyz; touch evil@example\.com> " &&
 +              git rev-list -1 --pretty=raw refs/remotes/git-svn >actual &&
 +              grep "^author xyz; touch evil <xyz; touch evil@example\.com> " actual &&
                ! test -f evil
        )
  '