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

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 <>
 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) {
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at

Reply via email to