From: Bryan Jacobs <bjacobs@woti.com>
To: Avishay Lavie <avishay.lavie@gmail.com>
Cc: git@vger.kernel.org, Eric Wong <normalperson@yhbt.net>
Subject: Re: [PATCH] git svn dcommit: avoid self-referential mergeinfo lines when svn.pushmergeinfo is configured
Date: Wed, 14 Mar 2012 12:15:56 -0400 [thread overview]
Message-ID: <20120314121556.44e4054a@robyn.woti.com> (raw)
In-Reply-To: <CAHkK2bpq1J2SW2P1tkFnjw5dWEr=uQrfrTUaS2J-swuKsP4kig@mail.gmail.com>
This patch looks proper to me.
It's arguable that the real bug is SVN removing the
redundant-but-harmless mergeinfo lines, but that's neither here nor
there. git-svn should be as similar to the real SVN client as possible.
At my workplace we have not experienced the interoperability bug
described in the linked thread, and we work with both SVN and git-svn.
But it may be our SVN client does not exhibit the good/bad behavior, or
perhaps nobody has tried the workflow which causes it to be a problem.
Bryan Jacobs
On Wed, 14 Mar 2012 18:09:04 +0200
Avishay Lavie <avishay.lavie@gmail.com> wrote:
> [PATCH] git svn dcommit: avoid self-referential mergeinfo lines when
> svn.pushmergeinfo flag is configured
>
> When svn.pushmergeinfo is configured, git svn dcommit tries to
> automatically populate svn:mergeinfo properties by merging the parent
> branch's mergeinfo into the committed one on each merge commit. This
> process can add self-referential mergeinfo lines, i.e. ones that
> reference the same branch being committed into (e.g. when
> reintegrating a branch to trunk after previously having merged trunk
> into it), which are then mishandled by SVN and cause errors in mixed
> SVN/Git environments.
> For more details, see my original report on the issue at [1].
>
> This commit adds a step to git svn dcommit that filters out any
> mergeinfo lines referencing the target branch from the mergeinfo, thus
> avoiding the problem.
>
> [1] http://thread.gmane.org/gmane.comp.version-control.git/191932
>
> Signed-off-by: Avishay Lavie <avishay.lavie@gmail.com>
> ---
> This is my first time sending a patch to the group, so if I'm doing
> something wrong, please let me know.
>
> git-svn.perl | 15 +++++++++++++++
> 1 files changed, 15 insertions(+), 0 deletions(-)
>
> diff --git a/git-svn.perl b/git-svn.perl
> index eeb83d3..1ed409d 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -752,6 +752,19 @@ sub populate_merge_info {
> return undef;
> }
>
> +sub remove_self_referential_merge_info {
> + return $_merge_info unless defined $_merge_info;
> +
> + my ($_merge_info, $branchurl, $gs) = @_;
> + my $rooturl = $gs->repos_root;
> +
> + unless ($branchurl =~ /^\Q$rooturl\E(.*)/) {
> + fatal "URL to commit to is not under SVN root
> $rooturl!";
> + }
> + my $branchpath = $1;
> + return join("\n", grep { $_ !~ m/^$branchpath\:/ }
> split(/\n/, $_merge_info)); +}
> +
> sub cmd_dcommit {
> my $head = shift;
> command_noisy(qw/update-index --refresh/);
> @@ -902,6 +915,8 @@ sub cmd_dcommit {
> $uuid,
> $linear_refs,
> $rewritten_parent);
> +
> + $_merge_info =
> remove_self_referential_merge_info($_merge_info, $url, $gs); }
>
> my %ed_opts = ( r => $last_rev,
next prev parent reply other threads:[~2012-03-14 16:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-14 16:09 [PATCH] git svn dcommit: avoid self-referential mergeinfo lines when svn.pushmergeinfo is configured Avishay Lavie
2012-03-14 16:15 ` Bryan Jacobs [this message]
2012-03-14 16:23 ` Thomas Rast
2012-03-15 22:02 ` Eric Wong
2012-03-15 22:07 ` Bryan Jacobs
2012-03-15 22:28 ` [spf:guess] " Sam Vilain
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=20120314121556.44e4054a@robyn.woti.com \
--to=bjacobs@woti.com \
--cc=avishay.lavie@gmail.com \
--cc=git@vger.kernel.org \
--cc=normalperson@yhbt.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).