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

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

From
Avishay Lavie <avishay.lavie@gmail.com>
Date
Aug 23, 2012, 16:07 UTC
Message-ID
<CAHkK2bpCjmxTKmBj6Wqgmky2YjRk8_MQF6th8xxc6XoStdVOeg@mail.gmail.com>
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) {
-- 
1.7.10.msysgit.1
Next: Eric Wong
Message 1 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.