summaryrefslogtreecommitdiff
path: root/git-svn.perl
diff options
context:
space:
mode:
authorAvery Pennarun <apenwarr@gmail.com>2008-07-30 20:53:55 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-08-04 01:13:53 (GMT)
commit611921654ffb854338ab758009a93c70054fab7f (patch)
tree7e3a01c463a86d8ed0c262e01921ddf6be8a9264 /git-svn.perl
parent2c3766f06adf0ba226a592939971f8ef587e54c1 (diff)
downloadgit-611921654ffb854338ab758009a93c70054fab7f.zip
git-611921654ffb854338ab758009a93c70054fab7f.tar.gz
git-611921654ffb854338ab758009a93c70054fab7f.tar.bz2
git-svn: Abort with an error if 'fetch' parameter is invalid.
Previously, if a config entry looked like this: svn-remote.svn.fetch=:refs/heads/whatever git-svn would silently do nothing if you asked it to "git svn fetch", and give a strange error if asked to "git svn dcommit". What it really wants is a line that looks like this: svn-remote.svn.fetch=:refs/remotes/whatever So we should simply abort if we get the wrong thing. On the other hand, there's actually no good reason for git-svn to enforce using the refs/remotes namespace, but the code seems to have hardcoded this in several places and I'm not brave enough to try to fix it all right now. Signed-off-by: Avery Pennarun <apenwarr@gmail.com> Acked-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-svn.perl')
-rwxr-xr-xgit-svn.perl8
1 files changed, 6 insertions, 2 deletions
diff --git a/git-svn.perl b/git-svn.perl
index cf6dbbc..cc35f50 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -1420,8 +1420,12 @@ sub read_all_remotes {
svn.useSvmProps/) };
$use_svm_props = $use_svm_props eq 'true' if $use_svm_props;
foreach (grep { s/^svn-remote\.// } command(qw/config -l/)) {
- if (m!^(.+)\.fetch=\s*(.*)\s*:\s*refs/remotes/(.+)\s*$!) {
- my ($remote, $local_ref, $remote_ref) = ($1, $2, $3);
+ if (m!^(.+)\.fetch=\s*(.*)\s*:\s*(.+)\s*$!) {
+ my ($remote, $local_ref, $_remote_ref) = ($1, $2, $3);
+ die("svn-remote.$remote: remote ref '$_remote_ref' "
+ . "must start with 'refs/remotes/'\n")
+ unless $_remote_ref =~ m{^refs/remotes/(.+)};
+ my $remote_ref = $1;
$local_ref =~ s{^/}{};
$r->{$remote}->{fetch}->{$local_ref} = $remote_ref;
$r->{$remote}->{svm} = {} if $use_svm_props;