Skip to content

Commit

Permalink
git-svn: Abort with an error if 'fetch' parameter is invalid.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Avery Pennarun authored and Junio C Hamano committed Aug 4, 2008
1 parent 2c3766f commit 6119216
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions git-svn.perl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6119216

Please sign in to comment.