From: Eric Wong <normalperson@yhbt.net>
To: "Jan Krüger" <jk@jk.gs>
Cc: Git mailing list <git@vger.kernel.org>
Subject: Re: [PATCH] git-svn: make rebuild respect rewriteRoot option
Date: Sat, 21 Jun 2008 14:39:33 -0700 [thread overview]
Message-ID: <20080621213911.GA19691@untitled> (raw)
In-Reply-To: <20080620003359.0dbb7725@neuron>
Jan Krüger <jk@jk.gs> wrote:
> Suppose someone fetches git-svn-ified commits from another repo and then
> attempts to use 'git-svn init --rewrite-root=foo bar'. Using git svn rebase
> after that will fail badly:
>
> * For each commit tried by working_head_info, rebuild is called indirectly.
> * rebuild will iterate over all commits and skip all of them because the
> URL does not match. Because of that no rev_map file is generated at all.
> * Thus, rebuild will run once for every commit. This takes ages.
> * In the end there still isn't any rev_map file and thus working_head_info
> fails.
>
> Addressing this behaviour fixes an apparently not too uncommon problem with
> providing git-svn mirrors of Subversion repositories. Some repositories are
> accessed using different URLs depending on whether the user has push
> privileges or not. In the latter case, an anonymous URL is often used that
> differs from the push URL. Providing a mirror that is usable in both cases
> becomes a lot more possible with this change.
>
> Signed-off-by: Jan Krüger <jk@jk.gs>
> ---
> Since this patch focuses on a case that is discouraged by the git-svn
> manpage (use rewriteRoot even though commits already exist), a bit of
> discussion might be helpful. On the up side, I think it doesn't affect any
> other cases.
>
> The specific problem situation looks like this:
>
> % git fetch git://.../clone-of-some-svn-repo (...)
> % git svn init -s --rewrite-root=<url contained in fetched commits> <url \
> we want to use>
> % git svn rebase
> [Boom]
>
> This patch passes all existing git-svn tests; feel free to suggest
> additional test(s) to cover this sort of situation.
Seems to make sense to me... If you have a test case for this
it'd be nicer :)
Acked-by: Eric Wong <normalperson@yhbt.net>
> git-svn.perl | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/git-svn.perl b/git-svn.perl
> index a54979d..4c9c59b 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -2577,8 +2577,8 @@ sub rebuild {
> my ($log, $ctx) =
> command_output_pipe(qw/rev-list --pretty=raw --no-color --reverse/,
> $self->refname, '--');
> - my $full_url = $self->full_url;
> - remove_username($full_url);
> + my $metadata_url = $self->metadata_url;
> + remove_username($metadata_url);
> my $svn_uuid = $self->ra_uuid;
> my $c;
> while (<$log>) {
> @@ -2596,7 +2596,7 @@ sub rebuild {
> # if we merged or otherwise started elsewhere, this is
> # how we break out of it
> if (($uuid ne $svn_uuid) ||
> - ($full_url && $url && ($url ne $full_url))) {
> + ($metadata_url && $url && ($url ne $metadata_url))) {
> next;
> }
>
prev parent reply other threads:[~2008-06-21 21:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-19 22:33 [PATCH] git-svn: make rebuild respect rewriteRoot option Jan Krüger
2008-06-21 21:39 ` Eric Wong [this message]
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=20080621213911.GA19691@untitled \
--to=normalperson@yhbt.net \
--cc=git@vger.kernel.org \
--cc=jk@jk.gs \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.