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

Re: [PATCH] git svn: Only follow first parents when populating svn:mergeinfo properties

From
EWEric Wong <normalperson@yhbt.net>
Date
Sep 14, 2012, 21:50 UTC
Message-ID
<20120914215055.GB16293@dcvr.yhbt.net>
In-Reply-To
<CAHkK2bpCjmxTKmBj6Wqgmky2YjRk8_MQF6th8xxc6XoStdVOeg@mail.gmail.com>
I'm awaiting Sam's comment on this patch.
Avishay Lavie <avishay.lavie@gmail.com> wrote:
Show 43 quoted lines
> Subject: [PATCH] git svn: Only follow first parents when populating
> svn:mergeinfo
>  properties.
> 
> When svn.pushmergeinfo is set, git-svn tries to correctly populate mergeinfo
> properties when encountering a merge commit. It does so by first aggregating
> the mergeinfo property of the merged parent into the target, and then
> adding to it the SVN revision number of any commit reachable from the
> merged parent but not from the first (target) parent.
> 
> If a third branch was merged into the merged parent (e.g. X was merged into Y
> and Y was then merged into Z), its revisions will be listed twice --
> once as part
> of aggregating Y's mergeinfo property into Z's, and once more when walking
> the tree and finding X's commits reachable from Y's tip. While the first listing
> correctly lists those revisions as merged from X, the second listing
> will list them
> as merged from Y, creating incorrect mergeinfo properties that later cause
> unnecessary lookups and warnings when git-svn-fetching.
> 
> Adding '--first-parent' to the rev-list command fixes this by only walking the
> part of the tree that's directly included in the merged branch (Y) and not any
> branches merged into it (X).
> 
> Signed-off-by: Avishay Lavie <avishay.lavie@gmail.com>
> ---
>  git-svn.perl |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/git-svn.perl b/git-svn.perl
> index 828b8f0..f69a4d6 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -728,7 +728,7 @@ sub populate_merge_info {
> 
>   next if $parent eq $parents[0]; # Skip first parent
>   # Add new changes being placed in tree by merge
> - my @cmd = (qw/rev-list --reverse/,
> + my @cmd = (qw/rev-list --first-parent --reverse/,
>     $parent, qw/--not/);
>   foreach my $par (@parents) {
>   unless ($par eq $parent) {
> -- 

Your patch seems badly whitespace mangled. Fortunately it's a small change and I can fix it by hand.

Previous: Avishay Lavie
Message 2 of 2 in “git svn: Only follow first parents when populating svn:mergeinfo properties”
  1. git svn: Only follow first parents when populating svn:mergeinfo propertiesAvishay Lavie, Aug 23, 2012
  2. Eric WongSep 14, 2012

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.