# git-svn -t/-b should respect existing *

3 messages from 2008-03-13 to 2008-03-14. Participants: martin f krafft, Eric Wong.
Thread: https://gitlist.dev/t/12667

## martin f krafft, 2008-03-13 11:27

Subject: git-svn -t/-b should respect existing *
Message-ID: <20080313112738.GA28589@piper.oerlikon.madduck.net>
URL: https://gitlist.dev/e/20080313112738.GA28589%40piper.oerlikon.madduck.net

```
Hi folks,

My git-svn target configuration is

  [svn-remote "svn"]
    url = svn://svn.berlios.de/docutils
    fetch = trunk/docutils:refs/remotes/trunk
    branches = branches/*/docutils:refs/remotes/*
    tags = tags/*/docutils:refs/remotes/tags/*

Unfortunately, when I run

  git-svn init -T trunk/docutils -t 'tags/*/docutils' -b 'branches/*/docutils' ...

then I get (note the two asterisks on the left hand side):

    branches = branches/*/docutils/*:refs/remotes/*
    tags = tags/*/docutils/*:refs/remotes/tags/*

I took a brief stab at the code but I can't even figure out where
the /* is appended, so I defer to you.

It should be trivial to keep git-svn from appending /* if the left
side already contains an asterisk.

Thanks,

-- 
martin | http://madduck.net/ | http://two.sentenc.es/
 
"auch der mutigste von uns hat nur selten den mut zu dem,
 was er eigentlich weiß."
                                                 - friedrich nietzsche
 
spamtraps: madduck.bogus@madduck.net

```

## Eric Wong, 2008-03-14 18:01

Subject: [PATCH] git-svn: don't blindly append '*' to branch/tags config
Message-ID: <20080314180123.GB3107@hand.yhbt.net>
URL: https://gitlist.dev/e/20080314180123.GB3107%40hand.yhbt.net
In-Reply-To: <20080313112738.GA28589@piper.oerlikon.madduck.net>

```
Previously, git-svn would blindly append '*' even if it was specified by
the user during initialization (for certain SVN setups, it is
necessary).

Now, the following command will work correctly:

  git svn init -T trunk/docutils \
               -t 'tags/*/docutils' \
               -b 'branches/*/docutils' \
               svn://svn.berlios.de/docutils

Thanks to martin f krafft for the bug report:
> My git-svn target configuration is
>
>   [svn-remote "svn"]
>     url = svn://svn.berlios.de/docutils
>     fetch = trunk/docutils:refs/remotes/trunk
>     branches = branches/*/docutils:refs/remotes/*
>     tags = tags/*/docutils:refs/remotes/tags/*
>
> Unfortunately, when I run
>
>   git-svn init -T trunk/docutils -t 'tags/*/docutils'
>    -b 'branches/*/docutils'
>
> then I get (note the two asterisks on the left hand side):
>
>     branches = branches/*/docutils/*:refs/remotes/*
>     tags = tags/*/docutils/*:refs/remotes/tags/*
>
> I took a brief stab at the code but I can't even figure out where
> the /* is appended, so I defer to you.
>
> It should be trivial to keep git-svn from appending /* if the left
> side already contains an asterisk.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
---

 git-svn.perl |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index d8b38c9..bba22c1 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -958,9 +958,10 @@ sub complete_url_ls_init {
 		    "wanted to set to: $gs->{url}\n";
 	}
 	command_oneline('config', $k, $gs->{url}) unless $orig_url;
-	my $remote_path = "$ra->{svn_path}/$repo_path/*";
+	my $remote_path = "$ra->{svn_path}/$repo_path";
 	$remote_path =~ s#/+#/#g;
 	$remote_path =~ s#^/##g;
+	$remote_path .= "/*" if $remote_path !~ /\*/;
 	my ($n) = ($switch =~ /^--(\w+)/);
 	if (length $pfx && $pfx !~ m#/$#) {
 		die "--prefix='$pfx' must have a trailing slash '/'\n";
-- 
Eric Wong

```

## martin f krafft, 2008-03-14 19:39

Subject: Re: [PATCH] git-svn: don't blindly append '*' to branch/tags config
Message-ID: <20080314193941.GA24022@piper.oerlikon.madduck.net>
URL: https://gitlist.dev/e/20080314193941.GA24022%40piper.oerlikon.madduck.net
In-Reply-To: <20080314180123.GB3107@hand.yhbt.net>

```
also sprach Eric Wong <normalperson@yhbt.net> [2008.03.14.1901 +0100]:
> Previously, git-svn would blindly append '*' even if it was specified by
> the user during initialization (for certain SVN setups, it is
> necessary).
> 
> Now, the following command will work correctly:
> 
>   git svn init -T trunk/docutils \
>                -t 'tags/*/docutils' \
>                -b 'branches/*/docutils' \
>                svn://svn.berlios.de/docutils

I can confirm this. Thanks, Eric for the blazing turnaround time.

-- 
martin | http://madduck.net/ | http://two.sentenc.es/
 
"the surest way to corrupt a youth is to instruct him to hold in
 higher esteem those who think alike than those who think
 differently."
                                              -- friedrich nietzsche
 
spamtraps: madduck.bogus@madduck.net

```
