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/t9130-git-svn-authors-file.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 / t9130-git-svn-authors-file.sh` 131 lines ยท 3628 bytes Raw Blame History 1 #!/bin/sh 2 # 3 # Copyright (c) 2008 Eric Wong 4 # 5 6 test_description='git svn authors file tests' 7 8 . ./lib-git-svn.sh 9 10 cat > svn-authors < 12 bb = BBBBBBB BBBBBBB 13 EOF 14 15 test_expect_success 'setup svnrepo' ' 16 for i in aa bb cc dd 17 do 18 svn_cmd mkdir -m $i --username $i "$svnrepo"/$i || return 1 19 done 20 ' 21 22 test_expect_success 'start import with incomplete authors file' ' 23 test_must_fail git svn clone --authors-file=svn-authors "$svnrepo" x 24 ' 25 26 test_expect_success 'imported 2 revisions successfully' ' 27 ( 28 cd x && 29 git rev-list refs/remotes/git-svn >actual && 30 test_line_count = 2 actual && 31 git rev-list -1 --pretty=raw refs/remotes/git-svn >actual && 32 test_grep "^author BBBBBBB BBBBBBB " actual && 33 git rev-list -1 --pretty=raw refs/remotes/git-svn~1 >actual && 34 test_grep "^author AAAAAAA AAAAAAA " actual 35 ) 36 ' 37 38 cat >> svn-authors < 40 dd = DDDDDDD DDDDDDD 41 EOF 42 43 test_expect_success 'continues to import once authors have been added' ' 44 ( 45 cd x && 46 git svn fetch --authors-file=../svn-authors && 47 git rev-list refs/remotes/git-svn >actual && 48 test_line_count = 4 actual && 49 git rev-list -1 --pretty=raw refs/remotes/git-svn >actual && 50 test_grep "^author DDDDDDD DDDDDDD " actual && 51 git rev-list -1 --pretty=raw refs/remotes/git-svn~1 >actual && 52 test_grep "^author CCCCCCC CCCCCCC " actual 53 ) 54 ' 55 56 test_expect_success 'authors-file against globs' ' 57 svn_cmd mkdir -m globs --username aa \ 58 "$svnrepo"/aa/trunk "$svnrepo"/aa/branches "$svnrepo"/aa/tags && 59 git svn clone --authors-file=svn-authors -s "$svnrepo"/aa aa-work && 60 for i in bb ee cc 61 do 62 branch="aa/branches/$i" && 63 svn_cmd mkdir -m "$branch" --username $i "$svnrepo/$branch" || return 1 64 done 65 ' 66 67 test_expect_success 'fetch fails on ee' ' 68 ( cd aa-work && test_must_fail git svn fetch --authors-file=../svn-authors ) 69 ' 70 71 tmp_config_get () { 72 git config --file=.git/svn/.metadata --get "$1" 73 } 74 75 test_expect_success 'failure happened without negative side effects' ' 76 ( 77 cd aa-work && 78 test 6 -eq "$(tmp_config_get svn-remote.svn.branches-maxRev)" && 79 test 6 -eq "$(tmp_config_get svn-remote.svn.tags-maxRev)" 80 ) 81 ' 82 83 cat >> svn-authors < 85 EOF 86 87 test_expect_success 'fetch continues after authors-file is fixed' ' 88 ( 89 cd aa-work && 90 git svn fetch --authors-file=../svn-authors && 91 test 8 -eq "$(tmp_config_get svn-remote.svn.branches-maxRev)" && 92 test 8 -eq "$(tmp_config_get svn-remote.svn.tags-maxRev)" 93 ) 94 ' 95 96 test_expect_success !MINGW 'fresh clone with svn.authors-file in config' ' 97 ( 98 rm -r "$GIT_DIR" && 99 test x = x"$(git config svn.authorsfile)" && 100 test_config="$HOME"/.gitconfig && 101 sane_unset GIT_DIR && 102 git config --global \ 103 svn.authorsfile "$HOME"/svn-authors && 104 test x"$HOME"/svn-authors = x"$(git config svn.authorsfile)" && 105 git svn clone "$svnrepo" gitconfig.clone && 106 cd gitconfig.clone && 107 git log >actual && 108 nr_ex=$(grep "^Author:.*example.com" actual | wc -l) && 109 git rev-list HEAD >actual && 110 nr_rev=$(wc -l > svn-authors < 117 EOF 118 119 test_expect_success 'authors-file imported user without email' ' 120 svn_cmd mkdir -m aa/branches/ff --username ff "$svnrepo/aa/branches/ff" && 121 ( 122 cd aa-work && 123 git svn fetch --authors-file=../svn-authors && 124 git rev-list -1 --pretty=raw refs/remotes/origin/ff | \ 125 grep "^author FFFFFFF FFFFFFF <> " 126 ) 127 ' 128 129 test_debug 'GIT_DIR=gitconfig.clone/.git git log' 130 131 test_done