2009-01-12 00:44:07 +01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Copyright (c) 2008 Eric Wong
|
|
|
|
#
|
|
|
|
|
|
|
|
test_description='git svn authors file tests'
|
|
|
|
|
|
|
|
. ./lib-git-svn.sh
|
|
|
|
|
|
|
|
cat > svn-authors <<EOF
|
|
|
|
aa = AAAAAAA AAAAAAA <aa@example.com>
|
|
|
|
bb = BBBBBBB BBBBBBB <bb@example.com>
|
|
|
|
EOF
|
|
|
|
|
|
|
|
test_expect_success 'setup svnrepo' '
|
|
|
|
for i in aa bb cc dd
|
|
|
|
do
|
2021-12-09 06:11:15 +01:00
|
|
|
svn_cmd mkdir -m $i --username $i "$svnrepo"/$i || return 1
|
2009-01-12 00:44:07 +01:00
|
|
|
done
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'start import with incomplete authors file' '
|
2010-07-21 01:18:34 +02:00
|
|
|
test_must_fail git svn clone --authors-file=svn-authors "$svnrepo" x
|
2009-01-12 00:44:07 +01:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'imported 2 revisions successfully' '
|
|
|
|
(
|
2018-07-02 02:24:04 +02:00
|
|
|
cd x &&
|
2018-03-27 19:31:37 +02:00
|
|
|
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
|
2009-01-12 00:44:07 +01:00
|
|
|
)
|
|
|
|
'
|
|
|
|
|
|
|
|
cat >> svn-authors <<EOF
|
|
|
|
cc = CCCCCCC CCCCCCC <cc@example.com>
|
|
|
|
dd = DDDDDDD DDDDDDD <dd@example.com>
|
|
|
|
EOF
|
|
|
|
|
|
|
|
test_expect_success 'continues to import once authors have been added' '
|
|
|
|
(
|
2018-07-02 02:24:04 +02:00
|
|
|
cd x &&
|
2009-01-12 00:44:07 +01:00
|
|
|
git svn fetch --authors-file=../svn-authors &&
|
2018-03-27 19:31:37 +02:00
|
|
|
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
|
2009-01-12 00:44:07 +01:00
|
|
|
)
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'authors-file against globs' '
|
2009-05-08 10:06:16 +02:00
|
|
|
svn_cmd mkdir -m globs --username aa \
|
2009-01-12 00:44:07 +01:00
|
|
|
"$svnrepo"/aa/trunk "$svnrepo"/aa/branches "$svnrepo"/aa/tags &&
|
|
|
|
git svn clone --authors-file=svn-authors -s "$svnrepo"/aa aa-work &&
|
|
|
|
for i in bb ee cc
|
|
|
|
do
|
tests: fix broken &&-chains in compound statements
The top-level &&-chain checker built into t/test-lib.sh causes tests to
magically exit with code 117 if the &&-chain is broken. However, it has
the shortcoming that the magic does not work within `{...}` groups,
`(...)` subshells, `$(...)` substitutions, or within bodies of compound
statements, such as `if`, `for`, `while`, `case`, etc. `chainlint.sed`
partly fills in the gap by catching broken &&-chains in `(...)`
subshells, but bugs can still lurk behind broken &&-chains in the other
cases.
Fix broken &&-chains in compound statements in order to reduce the
number of possible lurking bugs.
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-12-09 06:11:06 +01:00
|
|
|
branch="aa/branches/$i" &&
|
2021-12-09 06:11:15 +01:00
|
|
|
svn_cmd mkdir -m "$branch" --username $i "$svnrepo/$branch" || return 1
|
2009-01-12 00:44:07 +01:00
|
|
|
done
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'fetch fails on ee' '
|
2010-07-21 01:18:34 +02:00
|
|
|
( cd aa-work && test_must_fail git svn fetch --authors-file=../svn-authors )
|
2009-01-12 00:44:07 +01:00
|
|
|
'
|
|
|
|
|
|
|
|
tmp_config_get () {
|
2014-03-21 00:17:01 +01:00
|
|
|
git config --file=.git/svn/.metadata --get "$1"
|
2009-01-12 00:44:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
test_expect_success 'failure happened without negative side effects' '
|
|
|
|
(
|
|
|
|
cd aa-work &&
|
2016-01-12 12:49:29 +01:00
|
|
|
test 6 -eq "$(tmp_config_get svn-remote.svn.branches-maxRev)" &&
|
|
|
|
test 6 -eq "$(tmp_config_get svn-remote.svn.tags-maxRev)"
|
2009-01-12 00:44:07 +01:00
|
|
|
)
|
|
|
|
'
|
|
|
|
|
|
|
|
cat >> svn-authors <<EOF
|
|
|
|
ee = EEEEEEE EEEEEEE <ee@example.com>
|
|
|
|
EOF
|
|
|
|
|
|
|
|
test_expect_success 'fetch continues after authors-file is fixed' '
|
|
|
|
(
|
|
|
|
cd aa-work &&
|
|
|
|
git svn fetch --authors-file=../svn-authors &&
|
2016-01-12 12:49:29 +01:00
|
|
|
test 8 -eq "$(tmp_config_get svn-remote.svn.branches-maxRev)" &&
|
|
|
|
test 8 -eq "$(tmp_config_get svn-remote.svn.tags-maxRev)"
|
2009-01-12 00:44:07 +01:00
|
|
|
)
|
|
|
|
'
|
|
|
|
|
2016-01-27 17:20:22 +01:00
|
|
|
test_expect_success !MINGW 'fresh clone with svn.authors-file in config' '
|
2009-11-14 23:43:20 +01:00
|
|
|
(
|
|
|
|
rm -r "$GIT_DIR" &&
|
|
|
|
test x = x"$(git config svn.authorsfile)" &&
|
|
|
|
test_config="$HOME"/.gitconfig &&
|
2012-02-12 02:05:12 +01:00
|
|
|
sane_unset GIT_DIR &&
|
2009-11-14 23:43:20 +01:00
|
|
|
git config --global \
|
|
|
|
svn.authorsfile "$HOME"/svn-authors &&
|
|
|
|
test x"$HOME"/svn-authors = x"$(git config svn.authorsfile)" &&
|
|
|
|
git svn clone "$svnrepo" gitconfig.clone &&
|
|
|
|
cd gitconfig.clone &&
|
2018-03-27 19:31:37 +02:00
|
|
|
git log >actual &&
|
|
|
|
nr_ex=$(grep "^Author:.*example.com" actual | wc -l) &&
|
|
|
|
git rev-list HEAD >actual &&
|
|
|
|
nr_rev=$(wc -l <actual) &&
|
2009-11-14 23:43:20 +01:00
|
|
|
test $nr_rev -eq $nr_ex
|
|
|
|
)
|
|
|
|
'
|
|
|
|
|
2018-03-24 11:20:46 +01:00
|
|
|
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 <> "
|
|
|
|
)
|
|
|
|
'
|
|
|
|
|
2009-11-14 23:43:20 +01:00
|
|
|
test_debug 'GIT_DIR=gitconfig.clone/.git git log'
|
|
|
|
|
2009-01-12 00:44:07 +01:00
|
|
|
test_done
|