mirror of
https://github.com/git/git.git
synced 2024-12-01 22:13:45 +08:00
a2c6726417
* ab/test-2: (51 commits) tests: factor HOME=$(pwd) in test-lib.sh test-lib: use subshell instead of cd $new && .. && cd $old tests: simplify "missing PREREQ" message t/t0000-basic.sh: Run the passing TODO test inside its own test-lib test-lib: Allow overriding of TEST_DIRECTORY test-lib: Use "$GIT_BUILD_DIR" instead of "$TEST_DIRECTORY"/../ test-lib: Use $TEST_DIRECTORY or $GIT_BUILD_DIR instead of $(pwd) and ../ test: Introduce $GIT_BUILD_DIR cvs tests: do not touch test CVS repositories shipped with source t/t9602-cvsimport-branches-tags.sh: Add a PERL prerequisite t/t9601-cvsimport-vendor-branch.sh: Add a PERL prerequisite t/t7105-reset-patch.sh: Add a PERL prerequisite t/t9001-send-email.sh: convert setup code to tests t/t9001-send-email.sh: change from skip_all=* to prereq skip t/t9001-send-email.sh: Remove needless PROG=* assignment t/t9600-cvsimport.sh: change from skip_all=* to prereq skip lib-patch-mode tests: change from skip_all=* to prereq skip t/t3701-add-interactive.sh: change from skip_all=* to prereq skip tests: Move FILEMODE prerequisite to lib-prereq-FILEMODE.sh t/Makefile: Create test-results dir for smoke target ... Conflicts: t/t6035-merge-dir-to-symlink.sh
116 lines
3.1 KiB
Bash
Executable File
116 lines
3.1 KiB
Bash
Executable File
#!/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
|
|
svn_cmd mkdir -m $i --username $i "$svnrepo"/$i
|
|
done
|
|
'
|
|
|
|
test_expect_success 'start import with incomplete authors file' '
|
|
test_must_fail git svn clone --authors-file=svn-authors "$svnrepo" x
|
|
'
|
|
|
|
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> "
|
|
)
|
|
'
|
|
|
|
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' '
|
|
(
|
|
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> "
|
|
)
|
|
'
|
|
|
|
test_expect_success 'authors-file against globs' '
|
|
svn_cmd mkdir -m globs --username aa \
|
|
"$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
|
|
branch="aa/branches/$i"
|
|
svn_cmd mkdir -m "$branch" --username $i "$svnrepo/$branch"
|
|
done
|
|
'
|
|
|
|
test_expect_success 'fetch fails on ee' '
|
|
( cd aa-work && test_must_fail git svn fetch --authors-file=../svn-authors )
|
|
'
|
|
|
|
tmp_config_get () {
|
|
GIT_CONFIG=.git/svn/.metadata git config --get "$1"
|
|
}
|
|
|
|
test_expect_success 'failure happened without negative side effects' '
|
|
(
|
|
cd aa-work &&
|
|
test 6 -eq "`tmp_config_get svn-remote.svn.branches-maxRev`" &&
|
|
test 6 -eq "`tmp_config_get svn-remote.svn.tags-maxRev`"
|
|
)
|
|
'
|
|
|
|
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 &&
|
|
test 8 -eq "`tmp_config_get svn-remote.svn.branches-maxRev`" &&
|
|
test 8 -eq "`tmp_config_get svn-remote.svn.tags-maxRev`"
|
|
)
|
|
'
|
|
|
|
test_expect_success 'fresh clone with svn.authors-file in config' '
|
|
(
|
|
rm -r "$GIT_DIR" &&
|
|
test x = x"$(git config svn.authorsfile)" &&
|
|
test_config="$HOME"/.gitconfig &&
|
|
unset GIT_CONFIG_NOGLOBAL &&
|
|
unset GIT_DIR &&
|
|
unset GIT_CONFIG &&
|
|
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 &&
|
|
nr_ex=$(git log | grep "^Author:.*example.com" | wc -l) &&
|
|
nr_rev=$(git rev-list HEAD | wc -l) &&
|
|
test $nr_rev -eq $nr_ex
|
|
)
|
|
'
|
|
|
|
test_debug 'GIT_DIR=gitconfig.clone/.git git log'
|
|
|
|
test_done
|