git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: Michael Lai <myllai@gmail.com>
Cc: Tim Stoakes <tim@stoakes.net>, git@vger.kernel.org
Subject: Re: [RFC PATCH] git-svn does not support intermediate directories?
Date: Sat, 7 Mar 2009 20:43:18 -0800	[thread overview]
Message-ID: <20090308044318.GA31205@untitled> (raw)
In-Reply-To: <21fc26450903051612u1400b2b4gd71c3eafa4418e37@mail.gmail.com>

Michael Lai <myllai@gmail.com> wrote:
> I did some additional hacking and may have found a slightly cleaner
> way of at least fixing the problems with "git svn fetch".  The problem
> with the wrong paths being initialized for branches and tags is fairly
> minor (since you can just edit the config by hand), so I'll probably
> address that later, if I have time.  Here's the patch (I hope I'm
> doing this right):

Hi Michael,

Your patch was whitespace damaged and lacked a proposed commit message.
Please read Documentation/SubmittingPatches next time.

Anyhow, I fixed your patch up a bit.  Can you sign-off on it
if its right to you or let me know if it's broken?  Thanks.

From cddc7e5bde060eb963534156ae0daaf41c87c21a Mon Sep 17 00:00:00 2001
From: Eric Wong <normalperson@yhbt.net>
Date: Sat, 7 Mar 2009 20:22:29 -0800
Subject: [PATCH] git-svn: support intermediate paths when matching tags/branches
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

For repositories laid out like the following:

> [svn-remote "svn"]
>       url = http://foo.com/svn/repos/bar
>       fetch = myproject/trunk:refs/remotes/trunk
>       branches = bar/myproject/branches/*:refs/remotes/*
>       tags = bar/myproject/tags/*:refs/remotes/tags/*

The "bar" component above is considered the intermediate path
and was not handled correctly.

This patch was originally by Michael Lai (without a commit
message) with some minor fixes:

  * extraneous slash removed from $intermediate_path,
    this was causing tests to fail.

  * fixed a case where $intermediate_path could be "0" and
    considered false by Perl, preventing the necessary
    slash from being appended.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
 git-svn.perl |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index 959eb52..745dd03 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -2351,7 +2351,11 @@ sub match_paths {
 	if (my $path = $paths->{"/$self->{path}"}) {
 		return ($path->{action} eq 'D') ? 0 : 1;
 	}
-	$self->{path_regex} ||= qr/^\/\Q$self->{path}\E\//;
+	my $repos_root = $self->ra->{repos_root};
+	my $intermediate_path = $self->{url};
+	$intermediate_path =~ s#^\Q$repos_root\E(/|$)##;
+	$intermediate_path .= '/' if length($intermediate_path) > 0;
+	$self->{path_regex} ||= qr/^\/\Q$intermediate_path$self->{path}\E\//;
 	if (grep /$self->{path_regex}/, keys %$paths) {
 		return 1;
 	}
-- 
Eric Wong

  reply	other threads:[~2009-03-08  4:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-04  1:43 git-svn does not support intermediate directories? Michael Lai
2009-03-04  4:30 ` Tim Stoakes
2009-03-06  0:12   ` [RFC PATCH] " Michael Lai
2009-03-08  4:43     ` Eric Wong [this message]
2009-03-09 21:02       ` Michael Lai
2009-03-09 21:54         ` 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=20090308044318.GA31205@untitled \
    --to=normalperson@yhbt.net \
    --cc=git@vger.kernel.org \
    --cc=myllai@gmail.com \
    --cc=tim@stoakes.net \
    /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).