X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=git-debrebase;h=3458b12f5d86d93c2de804989afbed423cc43e92;hb=0de90d6589a4e11bdae9a6f8f1bab65156ea7c19;hp=9e8d7075d42e32bb24a270ecaf9db217162c4ad0;hpb=375a065009f11f786116a81d8d3a1edde32fe96b;p=dgit.git diff --git a/git-debrebase b/git-debrebase index 9e8d7075..3458b12f 100755 --- a/git-debrebase +++ b/git-debrebase @@ -1216,11 +1216,13 @@ sub cmd_new_upstream () { ) { my @oldpieces = (split / /, $1); my $old_n_parents = scalar @{ $old_upstream->{Parents} }; - if (@oldpieces != $old_n_parents) { + if ($old_n_parents != @oldpieces && + $old_n_parents != @oldpieces + 1) { snag 'upstream-confusing', sprintf "previous upstream combine %s". - " mentions %d pieces (each implying one orig commit)". - " but has %d parents", + " mentions %d pieces (each implying one parent)". + " but has %d parents". + " (one per piece plus maybe a previous combine)", $old_upstream->{CommitId}, (scalar @oldpieces), $old_n_parents; @@ -1233,7 +1235,8 @@ sub cmd_new_upstream () { $oldpieces[0] = ''; foreach my $i (0..$#oldpieces) { my $n = $oldpieces[$i]; - $piece->($n, Old => $old_upstream->{CommitId}.'^'.($i+1)); + my $hat = 1 + $i + ($old_n_parents - @oldpieces); + $piece->($n, Old => $old_upstream->{CommitId}.'^'.$hat); } } } else {