git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Avery Pennarun <apenwarr@gmail.com>
Subject: Re: [PATCH] git-svn: Abort with an error if 'fetch' parameter is invalid.
Date: Sun, 3 Aug 2008 17:01:40 -0700	[thread overview]
Message-ID: <20080804000140.GA13019@untitled> (raw)
In-Reply-To: <1217451235-9609-1-git-send-email-apenwarr@gmail.com>

Avery Pennarun <apenwarr@stasis.open.versabanq.com> wrote:
> 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.

Fully agreed (as I've stated in the past, too).  I just haven't had
time to fix it.

> Signed-off-by: Avery Pennarun <apenwarr@gmail.com>

Thanks Avery,
Acked-by: Eric Wong <normalperson@yhbt.net>

> ---
> 
> I just spent altogether too much time tracking down this problem when
> migrating my git-svn settings from one repo to another.
> 
>  git-svn.perl |    8 ++++++--
>  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;
> -- 
> 1.6.0.rc0.42.g186458.dirty
> 
> 

  parent reply	other threads:[~2008-08-04  0:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1217451235-9609-1-git-send-email-apenwarr@gmail.com>
2008-07-30 20:56 ` [PATCH] git-svn: Abort with an error if 'fetch' parameter is invalid Avery Pennarun
2008-08-04  0:01 ` Eric Wong [this message]
2008-08-04  0:21   ` Junio C Hamano
2008-08-04  0:46     ` Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080804000140.GA13019@untitled \
    --to=normalperson@yhbt.net \
    --cc=apenwarr@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).