git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] git-svn: Abort with an error if 'fetch' parameter is invalid.
       [not found] <1217451235-9609-1-git-send-email-apenwarr@gmail.com>
@ 2008-07-30 20:56 ` Avery Pennarun
  2008-08-04  0:01 ` Eric Wong
  1 sibling, 0 replies; 4+ messages in thread
From: Avery Pennarun @ 2008-07-30 20:56 UTC (permalink / raw)
  To: Avery Pennarun; +Cc: git, gitster, normalperson

On 7/30/08, Avery Pennarun <apenwarr@stasis.open.versabanq.com> wrote:
> ...

Please excuse the broken From: line on the above patch.  The
@gmail.com address is correct.

Avery

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] git-svn: Abort with an error if 'fetch' parameter is invalid.
       [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
  2008-08-04  0:21   ` Junio C Hamano
  1 sibling, 1 reply; 4+ messages in thread
From: Eric Wong @ 2008-08-04  0:01 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Avery Pennarun

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
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] git-svn: Abort with an error if 'fetch' parameter is invalid.
  2008-08-04  0:01 ` Eric Wong
@ 2008-08-04  0:21   ` Junio C Hamano
  2008-08-04  0:46     ` Eric Wong
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2008-08-04  0:21 UTC (permalink / raw)
  To: Eric Wong; +Cc: git, Avery Pennarun

Eric Wong <normalperson@yhbt.net> writes:

>> Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
>
> Thanks Avery,
> Acked-by: Eric Wong <normalperson@yhbt.net>

I do not seem to find the original message in mbox nor list archive, by
the way...

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] git-svn: Abort with an error if 'fetch' parameter is invalid.
  2008-08-04  0:21   ` Junio C Hamano
@ 2008-08-04  0:46     ` Eric Wong
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2008-08-04  0:46 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Avery Pennarun

Junio C Hamano <gitster@pobox.com> wrote:
> Eric Wong <normalperson@yhbt.net> writes:
> 
> >> Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
> >
> > Thanks Avery,
> > Acked-by: Eric Wong <normalperson@yhbt.net>
> 
> I do not seem to find the original message in mbox nor list archive, by
> the way...

Could've been Avery's original From: line not being spam filter
friendly.

Here you go (with From: line fixed)

>From 574c237f4561cf0293e7f44ab604bb701d1931f3 Mon Sep 17 00:00:00 2001
From: Avery Pennarun <apenwarr@gmail.com>
Date: Wed, 30 Jul 2008 16:53:55 -0400
Subject: [PATCH] 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>
---
 git-svn.perl |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index 0a346f8..1c39f45 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -1423,8 +1423,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;
-- 
Eric Wong

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-08-04  0:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [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
2008-08-04  0:21   ` Junio C Hamano
2008-08-04  0:46     ` Eric Wong

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).