summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4c03c3e)
raw | patch | inline | side by side (parent: 4c03c3e)
author | Eric Wong <normalperson@yhbt.net> | |
Sun, 13 May 2007 16:58:14 +0000 (09:58 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sun, 13 May 2007 19:10:43 +0000 (12:10 -0700) |
For tracking branches and tags, git-svn prefers to connect
to the root of the repository or at least the level that
houses branches and tags as well as trunk. However, users
that are accustomed to tracking a single directory have
no use for this feature.
As pointed out by Junio, users may not have permissions to
connect to connect to a higher-level path in the repository.
While the current minimize_url() function detects lack of
permissions to certain paths _after_ successful logins, it
cannot effectively determine if it is trying to access a
login-only portion of a repo when the user expects to
connect to a part where anonymous access is allowed.
For people used to the git-svnimport switches of
--trunk, --tags, --branches, they'll already pass the
repository root (or root+subdirectory), so minimize URL
isn't of too much use to them, either.
For people *not* used to git-svnimport, git-svn also
supports:
git svn init --minimize-url \
--trunk http://repository-root/foo/trunk \
--branches http://repository-root/foo/branches \
--tags http://repository-root/foo/tags
And this is where the new --minimize-url command-line switch
comes in to allow for this behavior to continue working.
to the root of the repository or at least the level that
houses branches and tags as well as trunk. However, users
that are accustomed to tracking a single directory have
no use for this feature.
As pointed out by Junio, users may not have permissions to
connect to connect to a higher-level path in the repository.
While the current minimize_url() function detects lack of
permissions to certain paths _after_ successful logins, it
cannot effectively determine if it is trying to access a
login-only portion of a repo when the user expects to
connect to a part where anonymous access is allowed.
For people used to the git-svnimport switches of
--trunk, --tags, --branches, they'll already pass the
repository root (or root+subdirectory), so minimize URL
isn't of too much use to them, either.
For people *not* used to git-svnimport, git-svn also
supports:
git svn init --minimize-url \
--trunk http://repository-root/foo/trunk \
--branches http://repository-root/foo/branches \
--tags http://repository-root/foo/tags
And this is where the new --minimize-url command-line switch
comes in to allow for this behavior to continue working.
diff --git a/git-svn.perl b/git-svn.perl
index ae14bab3a9bc6c02774e67a4c7f502730ce673d5..f4c9ff1b8520afadf9693fec1ece994fdad5d321 100755 (executable)
--- a/git-svn.perl
+++ b/git-svn.perl
my %init_opts = ( 'template=s' => \$_template, 'shared:s' => \$_shared,
'trunk|T=s' => \$_trunk, 'tags|t=s' => \$_tags,
'branches|b=s' => \$_branches, 'prefix=s' => \$_prefix,
+ 'minimize-url|m' => \$Git::SVN::_minimize_url,
'no-metadata' => sub { $icv{noMetadata} = 1 },
'use-svm-props' => sub { $icv{useSvmProps} = 1 },
'use-svnsync-props' => sub { $icv{useSvnsyncProps} = 1 },
use warnings;
use vars qw/$default_repo_id $default_ref_id $_no_metadata $_follow_parent
$_repack $_repack_flags $_use_svm_props $_head
- $_use_svnsync_props $no_reuse_existing/;
+ $_use_svnsync_props $no_reuse_existing $_minimize_url/;
use Carp qw/croak/;
use File::Path qw/mkpath/;
use File::Copy qw/copy/;
"[svn-remote \"$existing\"]\n";
}
$self->{repo_id} = $existing;
- } else {
+ } elsif ($_minimize_url) {
my $min_url = Git::SVN::Ra->new($url)->minimize_url;
$existing = find_existing_remote($min_url, $r);
if ($existing) {
index eb628fe07543d07812525942cba11b8133f2e000..70c3669ee81f4c6d5dd6ce75e4c7c18e33e93553 100755 (executable)
--- a/t/t9100-git-svn-basic.sh
+++ b/t/t9100-git-svn-basic.sh
test_expect_success \
'init allows us to connect to another directory in the same repo' "
- git-svn init -i bar $svnrepo/bar &&
+ git-svn init --minimize-url -i bar $svnrepo/bar &&
git config --get svn-remote.svn.fetch \
'^bar:refs/remotes/bar$' &&
git config --get svn-remote.svn.fetch \
index bd4f366e8687ebfeb53408c000a32ca1eda7334b..35aa45cb9addd862ca01f2f7eb39a863bb508364 100755 (executable)
"
test_expect_success 'init and fetch a moved directory' "
- git-svn init -i thunk $svnrepo/thunk &&
+ git-svn init --minimize-url -i thunk $svnrepo/thunk &&
git-svn fetch -i thunk &&
test \"\`git-rev-parse --verify refs/remotes/thunk@2\`\" \
= \"\`git-rev-parse --verify refs/remotes/thunk~1\`\" &&
echo hi > import/trunk/thunk/bump/thud/file &&
svn import -m 'import a larger parent' import $svnrepo/larger-parent &&
svn cp -m 'hi' $svnrepo/larger-parent $svnrepo/another-larger &&
- git-svn init -i larger $svnrepo/another-larger/trunk/thunk/bump/thud &&
+ git-svn init --minimize-url -i larger \
+ $svnrepo/another-larger/trunk/thunk/bump/thud &&
git-svn fetch -i larger &&
git-rev-parse --verify refs/remotes/larger &&
git-rev-parse --verify \
cd ..
svn mkdir -m 'new glob at top level' $svnrepo/glob &&
svn mv -m 'move blob down a level' $svnrepo/blob $svnrepo/glob/blob &&
- git-svn init -i blob $svnrepo/glob/blob &&
+ git-svn init --minimize-url -i blob $svnrepo/glob/blob &&
git-svn fetch -i blob
"
test_expect_success 'follow deleted directory' "
svn mv -m 'bye!' $svnrepo/glob/blob/hi $svnrepo/glob/blob/bye &&
svn rm -m 'remove glob' $svnrepo/glob &&
- git-svn init -i glob $svnrepo/glob &&
+ git-svn init --minimize-url -i glob $svnrepo/glob &&
git-svn fetch -i glob &&
test \"\`git cat-file blob refs/remotes/glob:blob/bye\`\" = hi &&
test \"\`git ls-tree refs/remotes/glob | wc -l \`\" -eq 1
poke native/t/c.t &&
svn commit -m 'reorg test' &&
cd .. &&
- git-svn init -i r9270-t \
+ git-svn init --minimize-url -i r9270-t \
$svnrepo/r9270/trunk/subversion/bindings/swig/perl/native/t &&
git-svn fetch -i r9270-t &&
test \`git rev-list r9270-t | wc -l\` -eq 2 &&
test_expect_success "track initial change if it was only made to parent" "
svn cp -m 'wheee!' $svnrepo/r9270/trunk $svnrepo/r9270/drunk &&
- git-svn init -i r9270-d \
+ git-svn init --minimize-url -i r9270-d \
$svnrepo/r9270/drunk/subversion/bindings/swig/perl/native/t &&
git-svn fetch -i r9270-d &&
test \`git rev-list r9270-d | wc -l\` -eq 3 &&
index c668dd127082ab400acd505e4970fb6f9cdbad1b..318e172ef5e8f20d3552f272c6c256f5c2677c68 100755 (executable)
test_expect_success 'commit-diff to a sub-directory (with git-svn config)' "
svn import -m 'sub-directory' import $svnrepo/subdir &&
- git-svn init $svnrepo/subdir &&
+ git-svn init --minimize-url $svnrepo/subdir &&
git-svn fetch &&
git-svn commit-diff -r3 '$prev' '$head' &&
svn cat $svnrepo/subdir/readme > readme.2 &&
index 9db0d8fd8d36c5762e436e237575d24eb1699dde..59e17f266374c837f0c1e0bd0a4a40fe22a773a6 100755 (executable)
test_expect_success 'load svm repo' "
svnadmin load -q $rawsvnrepo < ../t9110/svm.dump &&
- git-svn init -R arr -i bar $svnrepo/mirror/arr &&
- git-svn init -R argh -i dir $svnrepo/mirror/argh &&
- git-svn init -R argh -i e $svnrepo/mirror/argh/a/b/c/d/e &&
+ git-svn init --minimize-url -R arr -i bar $svnrepo/mirror/arr &&
+ git-svn init --minimize-url -R argh -i dir $svnrepo/mirror/argh &&
+ git-svn init --minimize-url -R argh -i e \
+ $svnrepo/mirror/argh/a/b/c/d/e &&
git-config svn.useSvmProps true &&
git-svn fetch --all
"
index 483d7f8159d9de5e1adaa73156b0645bf26ed62f..e52321471a3f49098e61c5a2f9257d354a628d3b 100755 (executable)
test_expect_success 'load svnsync repo' "
svnadmin load -q $rawsvnrepo < ../t9111/svnsync.dump &&
- git-svn init -R arr -i bar $svnrepo/bar &&
- git-svn init -R argh -i dir $svnrepo/dir &&
- git-svn init -R argh -i e $svnrepo/dir/a/b/c/d/e &&
+ git-svn init --minimize-url -R arr -i bar $svnrepo/bar &&
+ git-svn init --minimize-url -R argh -i dir $svnrepo/dir &&
+ git-svn init --minimize-url -R argh -i e $svnrepo/dir/a/b/c/d/e &&
git-config svn.useSvnsyncProps true &&
git-svn fetch --all
"