git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] git-svn: Abort with an error if 'fetch' parameter is invalid.

From
EWEric Wong <normalperson@yhbt.net>
Date
Aug 4, 2008, 00:46 UTC
Message-ID
<20080804004618.GA3182@untitled>
In-Reply-To
<7viquh7hpq.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> wrote:
Show 9 quoted lines
> 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
Previous: Junio C Hamano
Message 4 of 4 in “Re: [PATCH] git-svn: Abort with an error if 'fetch' parameter is invalid.”
  1. Avery PennarunJul 30, 2008
  2. Eric WongAug 4, 2008
  3. Junio C HamanoAug 4, 2008
  4. Eric WongAug 4, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.