提交 aeaa7e27 编写于 作者: J Junio C Hamano

Merge git://bogomips.org/git-svn

* git://bogomips.org/git-svn:
  Git 2.0: git svn: Set default --prefix='origin/' if --prefix is not given
...@@ -86,13 +86,11 @@ COMMANDS ...@@ -86,13 +86,11 @@ COMMANDS
(refs/remotes/$remote/*). Setting a prefix is also useful (refs/remotes/$remote/*). Setting a prefix is also useful
if you wish to track multiple projects that share a common if you wish to track multiple projects that share a common
repository. repository.
By default, the prefix is set to 'origin/'.
+ +
NOTE: In Git v2.0, the default prefix will CHANGE from "" (no prefix) NOTE: Before Git v2.0, the default prefix was "" (no prefix). This
to "origin/". This is done to put SVN-tracking refs at meant that SVN-tracking refs were put at "refs/remotes/*", which is
"refs/remotes/origin/*" instead of "refs/remotes/*", and make them incompatible with how Git's own remote-tracking refs are organized.
more compatible with how Git's own remote-tracking refs are organized
(i.e. refs/remotes/$remote/*). You can enjoy the same benefits today,
by using the --prefix option.
--ignore-paths=<regex>;; --ignore-paths=<regex>;;
When passed to 'init' or 'clone' this regular expression will When passed to 'init' or 'clone' this regular expression will
...@@ -994,16 +992,6 @@ without giving any repository layout options. If the full history with ...@@ -994,16 +992,6 @@ without giving any repository layout options. If the full history with
branches and tags is required, the options '--trunk' / '--branches' / branches and tags is required, the options '--trunk' / '--branches' /
'--tags' must be used. '--tags' must be used.
When using the options for describing the repository layout (--trunk,
--tags, --branches, --stdlayout), please also specify the --prefix
option (e.g. '--prefix=origin/') to cause your SVN-tracking refs to be
placed at refs/remotes/origin/* rather than the default refs/remotes/*.
The former is more compatible with the layout of Git's "regular"
remote-tracking refs (refs/remotes/$remote/*), and may potentially
prevent similarly named SVN branches and Git remotes from clobbering
each other. In Git v2.0 the default prefix used (i.e. when no --prefix
is given) will change from "" (no prefix) to "origin/".
When using multiple --branches or --tags, 'git svn' does not automatically When using multiple --branches or --tags, 'git svn' does not automatically
handle name collisions (for example, if two branches from different paths have handle name collisions (for example, if two branches from different paths have
the same name, or if a branch and a tag have the same name). In these cases, the same name, or if a branch and a tag have the same name). In these cases,
......
...@@ -1389,17 +1389,7 @@ sub cmd_multi_init { ...@@ -1389,17 +1389,7 @@ sub cmd_multi_init {
usage(1); usage(1);
} }
unless (defined $_prefix) { $_prefix = 'origin/' unless defined $_prefix;
$_prefix = '';
warn <<EOF
WARNING: --prefix is not given, defaulting to empty prefix.
This is probably not what you want! In order to stay compatible
with regular remote-tracking refs, provide a prefix like
--prefix=origin/ (remember the trailing slash), which will cause
the SVN-tracking refs to be placed at refs/remotes/origin/*.
NOTE: In Git v2.0, the default prefix will change from empty to 'origin/'.
EOF
}
if (defined $url) { if (defined $url) {
$url = canonicalize_url($url); $url = canonicalize_url($url);
init_subdir(@_); init_subdir(@_);
......
...@@ -45,27 +45,27 @@ test_expect_success 'initialize old-style (v0) git svn layout' ' ...@@ -45,27 +45,27 @@ test_expect_success 'initialize old-style (v0) git svn layout' '
test_expect_success 'initialize a multi-repository repo' ' test_expect_success 'initialize a multi-repository repo' '
git svn init "$svnrepo" -T trunk -t tags -b branches && git svn init "$svnrepo" -T trunk -t tags -b branches &&
git config --get-all svn-remote.svn.fetch > fetch.out && git config --get-all svn-remote.svn.fetch > fetch.out &&
grep "^trunk:refs/remotes/trunk$" fetch.out && grep "^trunk:refs/remotes/origin/trunk$" fetch.out &&
test -n "`git config --get svn-remote.svn.branches \ test -n "`git config --get svn-remote.svn.branches \
"^branches/\*:refs/remotes/\*$"`" && "^branches/\*:refs/remotes/origin/\*$"`" &&
test -n "`git config --get svn-remote.svn.tags \ test -n "`git config --get svn-remote.svn.tags \
"^tags/\*:refs/remotes/tags/\*$"`" && "^tags/\*:refs/remotes/origin/tags/\*$"`" &&
git config --unset svn-remote.svn.branches \ git config --unset svn-remote.svn.branches \
"^branches/\*:refs/remotes/\*$" && "^branches/\*:refs/remotes/origin/\*$" &&
git config --unset svn-remote.svn.tags \ git config --unset svn-remote.svn.tags \
"^tags/\*:refs/remotes/tags/\*$" && "^tags/\*:refs/remotes/origin/tags/\*$" &&
git config --add svn-remote.svn.fetch "branches/a:refs/remotes/a" && git config --add svn-remote.svn.fetch "branches/a:refs/remotes/origin/a" &&
git config --add svn-remote.svn.fetch "branches/b:refs/remotes/b" && git config --add svn-remote.svn.fetch "branches/b:refs/remotes/origin/b" &&
for i in tags/0.1 tags/0.2 tags/0.3; do for i in tags/0.1 tags/0.2 tags/0.3; do
git config --add svn-remote.svn.fetch \ git config --add svn-remote.svn.fetch \
$i:refs/remotes/$i || exit 1; done && $i:refs/remotes/origin/$i || exit 1; done &&
git config --get-all svn-remote.svn.fetch > fetch.out && git config --get-all svn-remote.svn.fetch > fetch.out &&
grep "^trunk:refs/remotes/trunk$" fetch.out && grep "^trunk:refs/remotes/origin/trunk$" fetch.out &&
grep "^branches/a:refs/remotes/a$" fetch.out && grep "^branches/a:refs/remotes/origin/a$" fetch.out &&
grep "^branches/b:refs/remotes/b$" fetch.out && grep "^branches/b:refs/remotes/origin/b$" fetch.out &&
grep "^tags/0\.1:refs/remotes/tags/0\.1$" fetch.out && grep "^tags/0\.1:refs/remotes/origin/tags/0\.1$" fetch.out &&
grep "^tags/0\.2:refs/remotes/tags/0\.2$" fetch.out && grep "^tags/0\.2:refs/remotes/origin/tags/0\.2$" fetch.out &&
grep "^tags/0\.3:refs/remotes/tags/0\.3$" fetch.out && grep "^tags/0\.3:refs/remotes/origin/tags/0\.3$" fetch.out &&
grep "^:refs/${remotes_git_svn}" fetch.out grep "^:refs/${remotes_git_svn}" fetch.out
' '
...@@ -73,14 +73,14 @@ test_expect_success 'initialize a multi-repository repo' ' ...@@ -73,14 +73,14 @@ test_expect_success 'initialize a multi-repository repo' '
test_expect_success 'multi-fetch works on partial urls + paths' " test_expect_success 'multi-fetch works on partial urls + paths' "
git svn multi-fetch && git svn multi-fetch &&
for i in trunk a b tags/0.1 tags/0.2 tags/0.3; do for i in trunk a b tags/0.1 tags/0.2 tags/0.3; do
git rev-parse --verify refs/remotes/\$i^0 >> refs.out || exit 1; git rev-parse --verify refs/remotes/origin/\$i^0 >> refs.out || exit 1;
done && done &&
test -z \"\`sort < refs.out | uniq -d\`\" && test -z \"\`sort < refs.out | uniq -d\`\" &&
for i in trunk a b tags/0.1 tags/0.2 tags/0.3; do for i in trunk a b tags/0.1 tags/0.2 tags/0.3; do
for j in trunk a b tags/0.1 tags/0.2 tags/0.3; do for j in trunk a b tags/0.1 tags/0.2 tags/0.3; do
if test \$j != \$i; then continue; fi if test \$j != \$i; then continue; fi
test -z \"\`git diff refs/remotes/\$i \ test -z \"\`git diff refs/remotes/origin/\$i \
refs/remotes/\$j\`\" ||exit 1; done; done refs/remotes/origin/\$j\`\" ||exit 1; done; done
" "
test_expect_success 'migrate --minimize on old inited layout' ' test_expect_success 'migrate --minimize on old inited layout' '
...@@ -98,27 +98,27 @@ test_expect_success 'migrate --minimize on old inited layout' ' ...@@ -98,27 +98,27 @@ test_expect_success 'migrate --minimize on old inited layout' '
git svn migrate --minimize && git svn migrate --minimize &&
test -z "`git config -l | grep "^svn-remote\.git-svn\."`" && test -z "`git config -l | grep "^svn-remote\.git-svn\."`" &&
git config --get-all svn-remote.svn.fetch > fetch.out && git config --get-all svn-remote.svn.fetch > fetch.out &&
grep "^trunk:refs/remotes/trunk$" fetch.out && grep "^trunk:refs/remotes/origin/trunk$" fetch.out &&
grep "^branches/a:refs/remotes/a$" fetch.out && grep "^branches/a:refs/remotes/origin/a$" fetch.out &&
grep "^branches/b:refs/remotes/b$" fetch.out && grep "^branches/b:refs/remotes/origin/b$" fetch.out &&
grep "^tags/0\.1:refs/remotes/tags/0\.1$" fetch.out && grep "^tags/0\.1:refs/remotes/origin/tags/0\.1$" fetch.out &&
grep "^tags/0\.2:refs/remotes/tags/0\.2$" fetch.out && grep "^tags/0\.2:refs/remotes/origin/tags/0\.2$" fetch.out &&
grep "^tags/0\.3:refs/remotes/tags/0\.3$" fetch.out && grep "^tags/0\.3:refs/remotes/origin/tags/0\.3$" fetch.out &&
grep "^:refs/${remotes_git_svn}" fetch.out grep "^:refs/${remotes_git_svn}" fetch.out
' '
test_expect_success ".rev_db auto-converted to .rev_map.UUID" ' test_expect_success ".rev_db auto-converted to .rev_map.UUID" '
git svn fetch -i trunk && git svn fetch -i trunk &&
test -z "$(ls "$GIT_DIR"/svn/refs/remotes/trunk/.rev_db.* 2>/dev/null)" && test -z "$(ls "$GIT_DIR"/svn/refs/remotes/origin/trunk/.rev_db.* 2>/dev/null)" &&
expect="$(ls "$GIT_DIR"/svn/refs/remotes/trunk/.rev_map.*)" && expect="$(ls "$GIT_DIR"/svn/refs/remotes/origin/trunk/.rev_map.*)" &&
test -n "$expect" && test -n "$expect" &&
rev_db="$(echo $expect | sed -e "s,_map,_db,")" && rev_db="$(echo $expect | sed -e "s,_map,_db,")" &&
convert_to_rev_db "$expect" "$rev_db" && convert_to_rev_db "$expect" "$rev_db" &&
rm -f "$expect" && rm -f "$expect" &&
test -f "$rev_db" && test -f "$rev_db" &&
git svn fetch -i trunk && git svn fetch -i trunk &&
test -z "$(ls "$GIT_DIR"/svn/refs/remotes/trunk/.rev_db.* 2>/dev/null)" && test -z "$(ls "$GIT_DIR"/svn/refs/remotes/origin/trunk/.rev_db.* 2>/dev/null)" &&
test ! -e "$GIT_DIR"/svn/refs/remotes/trunk/.rev_db && test ! -e "$GIT_DIR"/svn/refs/remotes/origin/trunk/.rev_db &&
test -f "$expect" test -f "$expect"
' '
......
...@@ -48,7 +48,7 @@ test_expect_success 'setup svn repository' ' ...@@ -48,7 +48,7 @@ test_expect_success 'setup svn repository' '
test_expect_success 'setup git mirror and merge' ' test_expect_success 'setup git mirror and merge' '
git svn init "$svnrepo" -t tags -T trunk -b branches && git svn init "$svnrepo" -t tags -T trunk -b branches &&
git svn fetch && git svn fetch &&
git checkout -b svn remotes/trunk && git checkout -b svn remotes/origin/trunk &&
git checkout -b merge && git checkout -b merge &&
echo new file > new_file && echo new file > new_file &&
git add new_file && git add new_file &&
...@@ -81,7 +81,7 @@ test_debug 'gitk --all & sleep 1' ...@@ -81,7 +81,7 @@ test_debug 'gitk --all & sleep 1'
test_expect_success 'verify post-merge ancestry' " test_expect_success 'verify post-merge ancestry' "
test x\`git rev-parse --verify refs/heads/svn\` = \ test x\`git rev-parse --verify refs/heads/svn\` = \
x\`git rev-parse --verify refs/remotes/trunk \` && x\`git rev-parse --verify refs/remotes/origin/trunk \` &&
test x\`git rev-parse --verify refs/heads/svn^2\` = \ test x\`git rev-parse --verify refs/heads/svn^2\` = \
x\`git rev-parse --verify refs/heads/merge\` && x\`git rev-parse --verify refs/heads/merge\` &&
git cat-file commit refs/heads/svn^ | grep '^friend$' git cat-file commit refs/heads/svn^ | grep '^friend$'
......
...@@ -20,20 +20,20 @@ test_expect_success 'setup repository and import' ' ...@@ -20,20 +20,20 @@ test_expect_success 'setup repository and import' '
) && ) &&
git svn init "$svnrepo" -T trunk -b branches -t tags && git svn init "$svnrepo" -T trunk -b branches -t tags &&
git svn fetch && git svn fetch &&
git reset --hard trunk && git reset --hard origin/trunk &&
echo bye >> README && echo bye >> README &&
git commit -a -m bye && git commit -a -m bye &&
git svn dcommit && git svn dcommit &&
git reset --hard a && git reset --hard origin/a &&
echo why >> FEEDME && echo why >> FEEDME &&
git update-index --add FEEDME && git update-index --add FEEDME &&
git commit -m feedme && git commit -m feedme &&
git svn dcommit && git svn dcommit &&
git reset --hard trunk && git reset --hard origin/trunk &&
echo aye >> README && echo aye >> README &&
git commit -a -m aye && git commit -a -m aye &&
git svn dcommit && git svn dcommit &&
git reset --hard b && git reset --hard origin/b &&
echo spy >> README && echo spy >> README &&
git commit -a -m spy && git commit -a -m spy &&
echo try >> README && echo try >> README &&
...@@ -42,26 +42,26 @@ test_expect_success 'setup repository and import' ' ...@@ -42,26 +42,26 @@ test_expect_success 'setup repository and import' '
' '
test_expect_success 'run log' " test_expect_success 'run log' "
git reset --hard a && git reset --hard origin/a &&
git svn log -r2 trunk | grep ^r2 && git svn log -r2 origin/trunk | grep ^r2 &&
git svn log -r4 trunk | grep ^r4 && git svn log -r4 origin/trunk | grep ^r4 &&
git svn log -r3 | grep ^r3 git svn log -r3 | grep ^r3
" "
test_expect_success 'run log against a from trunk' " test_expect_success 'run log against a from trunk' "
git reset --hard trunk && git reset --hard origin/trunk &&
git svn log -r3 a | grep ^r3 git svn log -r3 origin/a | grep ^r3
" "
printf 'r1 \nr2 \nr4 \n' > expected-range-r1-r2-r4 printf 'r1 \nr2 \nr4 \n' > expected-range-r1-r2-r4
test_expect_success 'test ascending revision range' " test_expect_success 'test ascending revision range' "
git reset --hard trunk && git reset --hard origin/trunk &&
git svn log -r 1:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2-r4 - git svn log -r 1:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2-r4 -
" "
test_expect_success 'test ascending revision range with --show-commit' " test_expect_success 'test ascending revision range with --show-commit' "
git reset --hard trunk && git reset --hard origin/trunk &&
git svn log --show-commit -r 1:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2-r4 - git svn log --show-commit -r 1:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2-r4 -
" "
...@@ -69,7 +69,7 @@ test_expect_success 'test ascending revision range with --show-commit (sha1)' " ...@@ -69,7 +69,7 @@ test_expect_success 'test ascending revision range with --show-commit (sha1)' "
git svn find-rev r1 >expected-range-r1-r2-r4-sha1 && git svn find-rev r1 >expected-range-r1-r2-r4-sha1 &&
git svn find-rev r2 >>expected-range-r1-r2-r4-sha1 && git svn find-rev r2 >>expected-range-r1-r2-r4-sha1 &&
git svn find-rev r4 >>expected-range-r1-r2-r4-sha1 && git svn find-rev r4 >>expected-range-r1-r2-r4-sha1 &&
git reset --hard trunk && git reset --hard origin/trunk &&
git svn log --show-commit -r 1:4 | grep '^r[0-9]' | cut -d'|' -f2 >out && git svn log --show-commit -r 1:4 | grep '^r[0-9]' | cut -d'|' -f2 >out &&
git rev-parse \$(cat out) >actual && git rev-parse \$(cat out) >actual &&
test_cmp expected-range-r1-r2-r4-sha1 actual test_cmp expected-range-r1-r2-r4-sha1 actual
...@@ -78,67 +78,67 @@ test_expect_success 'test ascending revision range with --show-commit (sha1)' " ...@@ -78,67 +78,67 @@ test_expect_success 'test ascending revision range with --show-commit (sha1)' "
printf 'r4 \nr2 \nr1 \n' > expected-range-r4-r2-r1 printf 'r4 \nr2 \nr1 \n' > expected-range-r4-r2-r1
test_expect_success 'test descending revision range' " test_expect_success 'test descending revision range' "
git reset --hard trunk && git reset --hard origin/trunk &&
git svn log -r 4:1 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4-r2-r1 - git svn log -r 4:1 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4-r2-r1 -
" "
printf 'r1 \nr2 \n' > expected-range-r1-r2 printf 'r1 \nr2 \n' > expected-range-r1-r2
test_expect_success 'test ascending revision range with unreachable revision' " test_expect_success 'test ascending revision range with unreachable revision' "
git reset --hard trunk && git reset --hard origin/trunk &&
git svn log -r 1:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2 - git svn log -r 1:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2 -
" "
printf 'r2 \nr1 \n' > expected-range-r2-r1 printf 'r2 \nr1 \n' > expected-range-r2-r1
test_expect_success 'test descending revision range with unreachable revision' " test_expect_success 'test descending revision range with unreachable revision' "
git reset --hard trunk && git reset --hard origin/trunk &&
git svn log -r 3:1 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r2-r1 - git svn log -r 3:1 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r2-r1 -
" "
printf 'r2 \n' > expected-range-r2 printf 'r2 \n' > expected-range-r2
test_expect_success 'test ascending revision range with unreachable upper boundary revision and 1 commit' " test_expect_success 'test ascending revision range with unreachable upper boundary revision and 1 commit' "
git reset --hard trunk && git reset --hard origin/trunk &&
git svn log -r 2:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r2 - git svn log -r 2:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r2 -
" "
test_expect_success 'test descending revision range with unreachable upper boundary revision and 1 commit' " test_expect_success 'test descending revision range with unreachable upper boundary revision and 1 commit' "
git reset --hard trunk && git reset --hard origin/trunk &&
git svn log -r 3:2 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r2 - git svn log -r 3:2 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r2 -
" "
printf 'r4 \n' > expected-range-r4 printf 'r4 \n' > expected-range-r4
test_expect_success 'test ascending revision range with unreachable lower boundary revision and 1 commit' " test_expect_success 'test ascending revision range with unreachable lower boundary revision and 1 commit' "
git reset --hard trunk && git reset --hard origin/trunk &&
git svn log -r 3:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 - git svn log -r 3:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 -
" "
test_expect_success 'test descending revision range with unreachable lower boundary revision and 1 commit' " test_expect_success 'test descending revision range with unreachable lower boundary revision and 1 commit' "
git reset --hard trunk && git reset --hard origin/trunk &&
git svn log -r 4:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 - git svn log -r 4:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 -
" "
printf -- '------------------------------------------------------------------------\n' > expected-separator printf -- '------------------------------------------------------------------------\n' > expected-separator
test_expect_success 'test ascending revision range with unreachable boundary revisions and no commits' " test_expect_success 'test ascending revision range with unreachable boundary revisions and no commits' "
git reset --hard trunk && git reset --hard origin/trunk &&
git svn log -r 5:6 | test_cmp expected-separator - git svn log -r 5:6 | test_cmp expected-separator -
" "
test_expect_success 'test descending revision range with unreachable boundary revisions and no commits' " test_expect_success 'test descending revision range with unreachable boundary revisions and no commits' "
git reset --hard trunk && git reset --hard origin/trunk &&
git svn log -r 6:5 | test_cmp expected-separator - git svn log -r 6:5 | test_cmp expected-separator -
" "
test_expect_success 'test ascending revision range with unreachable boundary revisions and 1 commit' " test_expect_success 'test ascending revision range with unreachable boundary revisions and 1 commit' "
git reset --hard trunk && git reset --hard origin/trunk &&
git svn log -r 3:5 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 - git svn log -r 3:5 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 -
" "
test_expect_success 'test descending revision range with unreachable boundary revisions and 1 commit' " test_expect_success 'test descending revision range with unreachable boundary revisions and 1 commit' "
git reset --hard trunk && git reset --hard origin/trunk &&
git svn log -r 5:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 - git svn log -r 5:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 -
" "
......
...@@ -83,25 +83,25 @@ EOF ...@@ -83,25 +83,25 @@ EOF
rm -f expect actual rm -f expect actual
} }
test_expect_success 'init with -s/-T/-b/-t without --prefix warns' ' test_expect_success 'init with -s/-T/-b/-t assumes --prefix=origin/' '
test ! -d project && test ! -d project &&
git svn init -s "$svnrepo"/project project 2>warning && git svn init -s "$svnrepo"/project project 2>warning &&
grep -q prefix warning && test_must_fail grep -q prefix warning &&
test_svn_configured_prefix "" && test_svn_configured_prefix "origin/" &&
rm -rf project && rm -rf project &&
rm -f warning rm -f warning
' '
test_expect_success 'clone with -s/-T/-b/-t without --prefix warns' ' test_expect_success 'clone with -s/-T/-b/-t assumes --prefix=origin/' '
test ! -d project && test ! -d project &&
git svn clone -s "$svnrepo"/project 2>warning && git svn clone -s "$svnrepo"/project 2>warning &&
grep -q prefix warning && test_must_fail grep -q prefix warning &&
test_svn_configured_prefix "" && test_svn_configured_prefix "origin/" &&
rm -rf project && rm -rf project &&
rm -f warning rm -f warning
' '
test_expect_success 'init with -s/-T/-b/-t and --prefix does not warn' ' test_expect_success 'init with -s/-T/-b/-t and --prefix="" still works' '
test ! -d project && test ! -d project &&
git svn init -s "$svnrepo"/project project --prefix="" 2>warning && git svn init -s "$svnrepo"/project project --prefix="" 2>warning &&
test_must_fail grep -q prefix warning && test_must_fail grep -q prefix warning &&
...@@ -110,7 +110,7 @@ test_expect_success 'init with -s/-T/-b/-t and --prefix does not warn' ' ...@@ -110,7 +110,7 @@ test_expect_success 'init with -s/-T/-b/-t and --prefix does not warn' '
rm -f warning rm -f warning
' '
test_expect_success 'clone with -s/-T/-b/-t and --prefix does not warn' ' test_expect_success 'clone with -s/-T/-b/-t and --prefix="" still works' '
test ! -d project && test ! -d project &&
git svn clone -s "$svnrepo"/project --prefix="" 2>warning && git svn clone -s "$svnrepo"/project --prefix="" 2>warning &&
test_must_fail grep -q prefix warning && test_must_fail grep -q prefix warning &&
......
...@@ -41,20 +41,20 @@ test_expect_success 'test clone with funky branch names' ' ...@@ -41,20 +41,20 @@ test_expect_success 'test clone with funky branch names' '
git svn clone -s "$svnrepo/pr ject" project && git svn clone -s "$svnrepo/pr ject" project &&
( (
cd project && cd project &&
git rev-parse "refs/remotes/fun%20plugin" && git rev-parse "refs/remotes/origin/fun%20plugin" &&
git rev-parse "refs/remotes/more%20fun%20plugin!" && git rev-parse "refs/remotes/origin/more%20fun%20plugin!" &&
git rev-parse "refs/remotes/$scary_ref" && git rev-parse "refs/remotes/origin/$scary_ref" &&
git rev-parse "refs/remotes/%2Eleading_dot" && git rev-parse "refs/remotes/origin/%2Eleading_dot" &&
git rev-parse "refs/remotes/trailing_dot%2E" && git rev-parse "refs/remotes/origin/trailing_dot%2E" &&
git rev-parse "refs/remotes/trailing_dotlock%2Elock" && git rev-parse "refs/remotes/origin/trailing_dotlock%2Elock" &&
git rev-parse "refs/remotes/$non_reflog" git rev-parse "refs/remotes/origin/$non_reflog"
) )
' '
test_expect_success 'test dcommit to funky branch' " test_expect_success 'test dcommit to funky branch' "
( (
cd project && cd project &&
git reset --hard 'refs/remotes/more%20fun%20plugin!' && git reset --hard 'refs/remotes/origin/more%20fun%20plugin!' &&
echo hello >> foo && echo hello >> foo &&
git commit -m 'hello' -- foo && git commit -m 'hello' -- foo &&
git svn dcommit git svn dcommit
...@@ -64,7 +64,7 @@ test_expect_success 'test dcommit to funky branch' " ...@@ -64,7 +64,7 @@ test_expect_success 'test dcommit to funky branch' "
test_expect_success 'test dcommit to scary branch' ' test_expect_success 'test dcommit to scary branch' '
( (
cd project && cd project &&
git reset --hard "refs/remotes/$scary_ref" && git reset --hard "refs/remotes/origin/$scary_ref" &&
echo urls are scary >> foo && echo urls are scary >> foo &&
git commit -m "eep" -- foo && git commit -m "eep" -- foo &&
git svn dcommit git svn dcommit
...@@ -74,7 +74,7 @@ test_expect_success 'test dcommit to scary branch' ' ...@@ -74,7 +74,7 @@ test_expect_success 'test dcommit to scary branch' '
test_expect_success 'test dcommit to trailing_dotlock branch' ' test_expect_success 'test dcommit to trailing_dotlock branch' '
( (
cd project && cd project &&
git reset --hard "refs/remotes/trailing_dotlock%2Elock" && git reset --hard "refs/remotes/origin/trailing_dotlock%2Elock" &&
echo who names branches like this anyway? >> foo && echo who names branches like this anyway? >> foo &&
git commit -m "bar" -- foo && git commit -m "bar" -- foo &&
git svn dcommit git svn dcommit
......
...@@ -58,19 +58,19 @@ test_expect_success 'test clone --stdlayout with percent escapes' ' ...@@ -58,19 +58,19 @@ test_expect_success 'test clone --stdlayout with percent escapes' '
git svn clone --stdlayout "$svnrepo/pr%20ject" percent && git svn clone --stdlayout "$svnrepo/pr%20ject" percent &&
( (
cd percent && cd percent &&
git rev-parse refs/remotes/trunk^0 && git rev-parse refs/remotes/origin/trunk^0 &&
git rev-parse refs/remotes/b^0 && git rev-parse refs/remotes/origin/b^0 &&
git rev-parse refs/remotes/tags/v1^0 git rev-parse refs/remotes/origin/tags/v1^0
) )
' '
test_expect_success 'test clone -s with unescaped space' ' test_expect_success 'test clone -s with unescaped space' '
git svn clone -s "$svnrepo/pr ject" space && git svn clone -s "$svnrepo/pr ject" --prefix origin/ space &&
( (
cd space && cd space &&
git rev-parse refs/remotes/trunk^0 && git rev-parse refs/remotes/origin/trunk^0 &&
git rev-parse refs/remotes/b^0 && git rev-parse refs/remotes/origin/b^0 &&
git rev-parse refs/remotes/tags/v1^0 git rev-parse refs/remotes/origin/tags/v1^0
) )
' '
......
...@@ -20,14 +20,14 @@ test_expect_success 'test clone with multi-glob in branch names' ' ...@@ -20,14 +20,14 @@ test_expect_success 'test clone with multi-glob in branch names' '
git svn clone -T trunk -b branches/*/* -t tags \ git svn clone -T trunk -b branches/*/* -t tags \
"$svnrepo/project" project && "$svnrepo/project" project &&
(cd project && (cd project &&
git rev-parse "refs/remotes/v14.1/beta" && git rev-parse "refs/remotes/origin/v14.1/beta" &&
git rev-parse "refs/remotes/v14.1/gold" git rev-parse "refs/remotes/origin/v14.1/gold"
) )
' '
test_expect_success 'test dcommit to multi-globbed branch' " test_expect_success 'test dcommit to multi-globbed branch' "
(cd project && (cd project &&
git reset --hard 'refs/remotes/v14.1/gold' && git reset --hard 'refs/remotes/origin/v14.1/gold' &&
echo hello >> foo && echo hello >> foo &&
git commit -m 'hello' -- foo && git commit -m 'hello' -- foo &&
git svn dcommit git svn dcommit
......
...@@ -29,30 +29,30 @@ test_expect_success 'initialize svnrepo' ' ...@@ -29,30 +29,30 @@ test_expect_success 'initialize svnrepo' '
test_expect_success 'import into git' ' test_expect_success 'import into git' '
git svn init --stdlayout "$svnrepo" && git svn init --stdlayout "$svnrepo" &&
git svn fetch && git svn fetch &&
git checkout remotes/trunk git checkout remotes/origin/trunk
' '
test_expect_success 'git svn branch tests' ' test_expect_success 'git svn branch tests' '
git svn branch a && git svn branch a &&
base=$(git rev-parse HEAD:) && base=$(git rev-parse HEAD:) &&
test $base = $(git rev-parse remotes/a:) && test $base = $(git rev-parse remotes/origin/a:) &&
git svn branch -m "created branch b blah" b && git svn branch -m "created branch b blah" b &&
test $base = $(git rev-parse remotes/b:) && test $base = $(git rev-parse remotes/origin/b:) &&
test_must_fail git branch -m "no branchname" && test_must_fail git branch -m "no branchname" &&
git svn branch -n c && git svn branch -n c &&
test_must_fail git rev-parse remotes/c && test_must_fail git rev-parse remotes/origin/c &&
test_must_fail git svn branch a && test_must_fail git svn branch a &&
git svn branch -t tag1 && git svn branch -t tag1 &&
test $base = $(git rev-parse remotes/tags/tag1:) && test $base = $(git rev-parse remotes/origin/tags/tag1:) &&
git svn branch --tag tag2 && git svn branch --tag tag2 &&
test $base = $(git rev-parse remotes/tags/tag2:) && test $base = $(git rev-parse remotes/origin/tags/tag2:) &&
git svn tag tag3 && git svn tag tag3 &&
test $base = $(git rev-parse remotes/tags/tag3:) && test $base = $(git rev-parse remotes/origin/tags/tag3:) &&
git svn tag -m "created tag4 foo" tag4 && git svn tag -m "created tag4 foo" tag4 &&
test $base = $(git rev-parse remotes/tags/tag4:) && test $base = $(git rev-parse remotes/origin/tags/tag4:) &&
test_must_fail git svn tag -m "no tagname" && test_must_fail git svn tag -m "no tagname" &&
git svn tag -n tag5 && git svn tag -n tag5 &&
test_must_fail git rev-parse remotes/tags/tag5 && test_must_fail git rev-parse remotes/origin/tags/tag5 &&
test_must_fail git svn tag tag1 test_must_fail git svn tag tag1
' '
......
...@@ -12,7 +12,7 @@ test_expect_success 'clone using git svn' 'git svn clone -s "$svnrepo" x' ...@@ -12,7 +12,7 @@ test_expect_success 'clone using git svn' 'git svn clone -s "$svnrepo" x'
test_expect_success 'test that b1 exists and is empty' ' test_expect_success 'test that b1 exists and is empty' '
( (
cd x && cd x &&
git reset --hard branch-c && git reset --hard origin/branch-c &&
test -f b1 && test -f b1 &&
! test -s b1 ! test -s b1
) )
......
...@@ -66,18 +66,18 @@ test_expect_success 'clone multiple branch and tag paths' ' ...@@ -66,18 +66,18 @@ test_expect_success 'clone multiple branch and tag paths' '
-t tags_A/* --tags tags_B \ -t tags_A/* --tags tags_B \
"$svnrepo/project" git_project && "$svnrepo/project" git_project &&
( cd git_project && ( cd git_project &&
git rev-parse refs/remotes/first && git rev-parse refs/remotes/origin/first &&
git rev-parse refs/remotes/second && git rev-parse refs/remotes/origin/second &&
git rev-parse refs/remotes/1 && git rev-parse refs/remotes/origin/1 &&
git rev-parse refs/remotes/2 && git rev-parse refs/remotes/origin/2 &&
git rev-parse refs/remotes/tags/1.0 && git rev-parse refs/remotes/origin/tags/1.0 &&
git rev-parse refs/remotes/tags/2.0 && git rev-parse refs/remotes/origin/tags/2.0 &&
git rev-parse refs/remotes/tags/3.0 && git rev-parse refs/remotes/origin/tags/3.0 &&
git rev-parse refs/remotes/tags/4.0 && git rev-parse refs/remotes/origin/tags/4.0 &&
git rev-parse refs/remotes/tags/v5 && git rev-parse refs/remotes/origin/tags/v5 &&
git rev-parse refs/remotes/tags/v6 && git rev-parse refs/remotes/origin/tags/v6 &&
git rev-parse refs/remotes/tags/v7 && git rev-parse refs/remotes/origin/tags/v7 &&
git rev-parse refs/remotes/tags/v8 git rev-parse refs/remotes/origin/tags/v8
) )
' '
...@@ -85,8 +85,8 @@ test_expect_success 'Multiple branch or tag paths require -d' ' ...@@ -85,8 +85,8 @@ test_expect_success 'Multiple branch or tag paths require -d' '
( cd git_project && ( cd git_project &&
test_must_fail git svn branch -m "No new branch" Nope && test_must_fail git svn branch -m "No new branch" Nope &&
test_must_fail git svn tag -m "No new tag" Tagless && test_must_fail git svn tag -m "No new tag" Tagless &&
test_must_fail git rev-parse refs/remotes/Nope && test_must_fail git rev-parse refs/remotes/origin/Nope &&
test_must_fail git rev-parse refs/remotes/tags/Tagless test_must_fail git rev-parse refs/remotes/origin/tags/Tagless
) && ) &&
( cd svn_project && ( cd svn_project &&
svn_cmd up && svn_cmd up &&
......
...@@ -17,7 +17,7 @@ test_expect_success 'git svn clone --stdlayout sets up trunk as master' ' ...@@ -17,7 +17,7 @@ test_expect_success 'git svn clone --stdlayout sets up trunk as master' '
git svn clone -s "$svnrepo" g && git svn clone -s "$svnrepo" g &&
( (
cd g && cd g &&
test x`git rev-parse --verify refs/remotes/trunk^0` = \ test x`git rev-parse --verify refs/remotes/origin/trunk^0` = \
x`git rev-parse --verify refs/heads/master^0` x`git rev-parse --verify refs/heads/master^0`
) )
' '
......
...@@ -35,8 +35,8 @@ test_expect_success 'fetch deleted tags from same revision with checksum error' ...@@ -35,8 +35,8 @@ test_expect_success 'fetch deleted tags from same revision with checksum error'
cd git_project && cd git_project &&
git svn fetch && git svn fetch &&
git diff --exit-code mybranch:trunk/subdir/file tags/mytag:file && git diff --exit-code origin/mybranch:trunk/subdir/file origin/tags/mytag:file &&
git diff --exit-code master:subdir/file tags/mytag^:file git diff --exit-code master:subdir/file origin/tags/mytag^:file
' '
test_done test_done
...@@ -36,9 +36,9 @@ test_expect_success 'fetch deleted tags from same revision with no checksum erro ...@@ -36,9 +36,9 @@ test_expect_success 'fetch deleted tags from same revision with no checksum erro
cd git_project && cd git_project &&
git svn fetch && git svn fetch &&
git diff --exit-code master:subdir3/file tags/mytag:file && git diff --exit-code master:subdir3/file origin/tags/mytag:file &&
git diff --exit-code master:subdir2/file tags/mytag^:file && git diff --exit-code master:subdir2/file origin/tags/mytag^:file &&
git diff --exit-code master:subdir1/file tags/mytag^^:file git diff --exit-code master:subdir1/file origin/tags/mytag^^:file
' '
test_done test_done
...@@ -18,8 +18,8 @@ test_expect_success 'load svn dump' " ...@@ -18,8 +18,8 @@ test_expect_success 'load svn dump' "
test_expect_success 'propagate merge information' ' test_expect_success 'propagate merge information' '
git config svn.pushmergeinfo yes && git config svn.pushmergeinfo yes &&
git checkout svnb1 && git checkout origin/svnb1 &&
git merge --no-ff svnb2 && git merge --no-ff origin/svnb2 &&
git svn dcommit git svn dcommit
' '
...@@ -29,7 +29,7 @@ test_expect_success 'check svn:mergeinfo' ' ...@@ -29,7 +29,7 @@ test_expect_success 'check svn:mergeinfo' '
' '
test_expect_success 'merge another branch' ' test_expect_success 'merge another branch' '
git merge --no-ff svnb3 && git merge --no-ff origin/svnb3 &&
git svn dcommit git svn dcommit
' '
...@@ -40,7 +40,7 @@ test_expect_success 'check primary parent mergeinfo respected' ' ...@@ -40,7 +40,7 @@ test_expect_success 'check primary parent mergeinfo respected' '
' '
test_expect_success 'merge existing merge' ' test_expect_success 'merge existing merge' '
git merge --no-ff svnb4 && git merge --no-ff origin/svnb4 &&
git svn dcommit git svn dcommit
' '
...@@ -53,7 +53,7 @@ test_expect_success "check both parents' mergeinfo respected" ' ...@@ -53,7 +53,7 @@ test_expect_success "check both parents' mergeinfo respected" '
' '
test_expect_success 'make further commits to branch' ' test_expect_success 'make further commits to branch' '
git checkout svnb2 && git checkout origin/svnb2 &&
touch newb2file && touch newb2file &&
git add newb2file && git add newb2file &&
git commit -m "later b2 commit" && git commit -m "later b2 commit" &&
...@@ -64,8 +64,8 @@ test_expect_success 'make further commits to branch' ' ...@@ -64,8 +64,8 @@ test_expect_success 'make further commits to branch' '
' '
test_expect_success 'second forward merge' ' test_expect_success 'second forward merge' '
git checkout svnb1 && git checkout origin/svnb1 &&
git merge --no-ff svnb2 && git merge --no-ff origin/svnb2 &&
git svn dcommit git svn dcommit
' '
...@@ -78,8 +78,8 @@ test_expect_success 'check new mergeinfo added' ' ...@@ -78,8 +78,8 @@ test_expect_success 'check new mergeinfo added' '
' '
test_expect_success 'reintegration merge' ' test_expect_success 'reintegration merge' '
git checkout svnb4 && git checkout origin/svnb4 &&
git merge --no-ff svnb1 && git merge --no-ff origin/svnb1 &&
git svn dcommit git svn dcommit
' '
...@@ -92,11 +92,11 @@ test_expect_success 'check reintegration mergeinfo' ' ...@@ -92,11 +92,11 @@ test_expect_success 'check reintegration mergeinfo' '
' '
test_expect_success 'dcommit a merge at the top of a stack' ' test_expect_success 'dcommit a merge at the top of a stack' '
git checkout svnb1 && git checkout origin/svnb1 &&
touch anotherfile && touch anotherfile &&
git add anotherfile && git add anotherfile &&
git commit -m "a commit" && git commit -m "a commit" &&
git merge svnb4 && git merge origin/svnb4 &&
git svn dcommit git svn dcommit
' '
......
...@@ -70,9 +70,9 @@ test_expect_success 'rebase looses SVN merge (m)' ' ...@@ -70,9 +70,9 @@ test_expect_success 'rebase looses SVN merge (m)' '
# #
test_expect_success 'reset and fetch gets the SVN merge (m) correctly' ' test_expect_success 'reset and fetch gets the SVN merge (m) correctly' '
git svn reset -r 3 && git svn reset -r 3 &&
git reset --hard trunk && git reset --hard origin/trunk &&
git svn fetch && git svn fetch &&
test 2 = $(git cat-file -p trunk|grep parent|wc -l) test 2 = $(git cat-file -p origin/trunk|grep parent|wc -l)
' '
test_done test_done
...@@ -53,7 +53,7 @@ test_expect_success 'clone svn repo' ' ...@@ -53,7 +53,7 @@ test_expect_success 'clone svn repo' '
' '
test_expect_success 'verify merge commit' 'x=$(git rev-parse HEAD^2) && test_expect_success 'verify merge commit' 'x=$(git rev-parse HEAD^2) &&
y=$(git rev-parse branch2) && y=$(git rev-parse origin/branch2) &&
test "x$x" = "x$y" test "x$x" = "x$y"
' '
......
...@@ -46,7 +46,7 @@ test_expect_success 'clone svn repo' ' ...@@ -46,7 +46,7 @@ test_expect_success 'clone svn repo' '
' '
test_expect_success 'verify merge commit' 'x=$(git rev-parse HEAD^2) && test_expect_success 'verify merge commit' 'x=$(git rev-parse HEAD^2) &&
y=$(git rev-parse branch2) && y=$(git rev-parse origin/branch2) &&
test "x$x" = "x$y" test "x$x" = "x$y"
' '
......
...@@ -31,7 +31,7 @@ test_expect_success 'import into git' ' ...@@ -31,7 +31,7 @@ test_expect_success 'import into git' '
git svn init --trunk=trunk/project --branches=branches/*/project \ git svn init --trunk=trunk/project --branches=branches/*/project \
--tags=tags/*/project "$svnrepo" && --tags=tags/*/project "$svnrepo" &&
git svn fetch && git svn fetch &&
git checkout remotes/trunk git checkout remotes/origin/trunk
' '
test_expect_success 'git svn branch tests' ' test_expect_success 'git svn branch tests' '
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册