Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/t9138-git-svn-authors-prog.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / t9138-git-svn-authors-prog.sh` 107 lines ยท 2909 bytes Raw Blame History 1 #!/bin/sh 2 # 3 # Copyright (c) 2009 Eric Wong, Mark Lodato 4 # 5 6 test_description='git svn authors prog tests' 7 8 . ./lib-git-svn.sh 9 10 write_script svn-authors-prog "$PERL_PATH" <<-\EOF 11 $_ = shift; 12 if (s/-hermit//) { 13 print "$_ <>\n"; 14 } elsif (s/-sub$//) { 15 print "$_ <$_\@sub.example.com>\n"; 16 } else { 17 print "$_ <$_\@example.com>\n"; 18 } 19 EOF 20 21 test_expect_success 'svn-authors setup' ' 22 cat >svn-authors <<-\EOF 23 ff = FFFFFFF FFFFFFF 24 EOF 25 ' 26 27 test_expect_success 'setup svnrepo' ' 28 for i in aa bb cc-sub dd-sub ee-foo ff 29 do 30 svn mkdir -m $i --username $i "$svnrepo"/$i || return 1 31 done 32 ' 33 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 37 ' 38 39 test_expect_success 'imported 6 revisions successfully' ' 40 ( 41 cd x && 42 git rev-list refs/remotes/git-svn >actual && 43 test_line_count = 6 actual 44 ) 45 ' 46 47 test_expect_success 'authors-prog ran correctly' ' 48 ( 49 cd x && 50 git rev-list -1 --pretty=raw refs/remotes/git-svn~1 >actual && 51 test_grep "^author ee-foo " actual && 52 git rev-list -1 --pretty=raw refs/remotes/git-svn~2 >actual && 53 test_grep "^author dd " actual && 54 git rev-list -1 --pretty=raw refs/remotes/git-svn~3 >actual && 55 test_grep "^author cc " actual && 56 git rev-list -1 --pretty=raw refs/remotes/git-svn~4 >actual && 57 test_grep "^author bb " actual && 58 git rev-list -1 --pretty=raw refs/remotes/git-svn~5 >actual && 59 test_grep "^author aa " actual 60 ) 61 ' 62 63 test_expect_success 'authors-file overrode authors-prog' ' 64 ( 65 cd x && 66 git rev-list -1 --pretty=raw refs/remotes/git-svn >actual && 67 test_grep "^author FFFFFFF FFFFFFF " actual 68 ) 69 ' 70 71 git --git-dir=x/.git config --unset svn.authorsfile || : 72 git --git-dir=x/.git config --unset svn.authorsprog || : 73 74 test_expect_success 'authors-prog imported user without email' ' 75 svn mkdir -m gg --username gg-hermit "$svnrepo"/gg && 76 ( 77 cd x && 78 git svn fetch --authors-prog=../svn-authors-prog && 79 git rev-list -1 --pretty=raw refs/remotes/git-svn | \ 80 grep "^author gg <> " 81 ) 82 ' 83 84 test_expect_success 'imported without authors-prog and authors-file' ' 85 svn mkdir -m hh --username hh "$svnrepo"/hh && 86 ( 87 uuid=$(svn info "$svnrepo" | 88 sed -n "s/^Repository UUID: //p") && 89 cd x && 90 git svn fetch && 91 git rev-list -1 --pretty=raw refs/remotes/git-svn | \ 92 grep "^author hh " 93 ) 94 ' 95 96 test_expect_success 'authors-prog handled special characters in username' ' 97 svn mkdir -m bad --username "xyz; touch evil" "$svnrepo"/bad && 98 ( 99 cd x && 100 git svn --authors-prog=../svn-authors-prog fetch && 101 git rev-list -1 --pretty=raw refs/remotes/git-svn >actual && 102 test_grep "^author xyz; touch evil " actual && 103 ! test -f evil 104 ) 105 ' 106 107 test_done