@matheusbsbs / matheus-bagliano / commits / 611921654f
Fork 0

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>

Avery Pennarun committed Jul 30, 2008 at 16:53 UTC 611921654ffb854338ab758009a93c70054fab7f
1 file changed +6 -2
git-svn.perl
+6 -2
@@ -1420,8 +1420,12 @@ sub read_all_remotes {
1420 svn.useSvmProps/) };
1421 $use_svm_props = $use_svm_props eq 'true' if $use_svm_props;
1422 foreach (grep { s/^svn-remote\.// } command(qw/config -l/)) {
1423 - if (m!^(.+)\.fetch=\s*(.*)\s*:\s*refs/remotes/(.+)\s*$!) {
1424 - my ($remote, $local_ref, $remote_ref) = ($1, $2, $3);
1423 + if (m!^(.+)\.fetch=\s*(.*)\s*:\s*(.+)\s*$!) {
1424 + my ($remote, $local_ref, $_remote_ref) = ($1, $2, $3);
1425 + die("svn-remote.$remote: remote ref '$_remote_ref' "
1426 + . "must start with 'refs/remotes/'\n")
1427 + unless $_remote_ref =~ m{^refs/remotes/(.+)};
1428 + my $remote_ref = $1;
1429 $local_ref =~ s{^/}{};
1430 $r->{$remote}->{fetch}->{$local_ref} = $remote_ref;
1431 $r->{$remote}->{svm} = {} if $use_svm_props;