Re: [PATCH] rebase-i: keep old parents when preserving merges

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH] rebase-i: keep old parents when preserving merges

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:44:57

Stephan Beyer [off-list ref] writes:

... Based on the discussion thread, here is a rewrite of the log message.
quoted hunk
When "rebase -i -p" tries to preserve merges of unrelated branches, it
lost some parents:

 - When you have more than two parents, the commit in the new history
   ends up with fewer than expected number of parents and this breakage
   goes unnoticed;

 - When you are rebasing a merge with two parents and one is lost, the
   command tries to cherry-pick the original merge commit, and the command
   fails.

Signed-off-by: Stephan Beyer <redacted>
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index a35212d..0df7640 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -174,6 +174,8 @@ pick_one_preserving_merges () {
 				new_parents="$new_parents $new_p"
 				;;
 			esac
+		else
+			new_parents="$new_parents $p"
 		fi
 	done
Reading the surrounding code, it makes me wonder if you also need to futz
with variables like $preserve and $fast_forward.

Re: [PATCH] rebase-i: keep old parents when preserving merges

From: Stephan Beyer <hidden>
Date: 2016-06-15 22:44:57

Hi,

Junio C Hamano wrote:
Stephan Beyer [off-list ref] writes:

... Based on the discussion thread, here is a rewrite of the log message.
quoted
When "rebase -i -p" tries to preserve merges of unrelated branches, it
lost some parents:

 - When you have more than two parents, the commit in the new history
   ends up with fewer than expected number of parents and this breakage
   goes unnoticed;

 - When you are rebasing a merge with two parents and one is lost, the
   command tries to cherry-pick the original merge commit, and the command
   fails.

Signed-off-by: Stephan Beyer <redacted>
Ok, big thanks :)
quoted
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index a35212d..0df7640 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -174,6 +174,8 @@ pick_one_preserving_merges () {
 				new_parents="$new_parents $new_p"
 				;;
 			esac
+		else
+			new_parents="$new_parents $p"
 		fi
 	done
Reading the surrounding code, it makes me wonder if you also need to futz
with variables like $preserve and $fast_forward.
No, I would not see a reason for that.

Regards,
  Stephan

-- 
Stephan Beyer [off-list ref], PGP 0x6EDDD207FCC5040F
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help