git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rebase-i: keep old parents when preserving merges
@ 2008-07-16  1:51 Stephan Beyer
  2008-07-16  2:26 ` Stephan Beyer
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Stephan Beyer @ 2008-07-16  1:51 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git, Stephan Beyer

This patch fixes two issues for rebase -i with preserving
merges of unrelated branches.

Merge parents that are part of an unrelated branch have not been
kept as a parent in some cases.
That means, a rewritten merge commit has either lost a parent
or rebase tried to cherry-pick this merge commit which resulted
in an error.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
---
 git-rebase--interactive.sh |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

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
 	case $fast_forward in
-- 
1.5.6.3.357.ge6ecd

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] rebase-i: keep old parents when preserving merges
  2008-07-16  1:51 [PATCH] rebase-i: keep old parents when preserving merges Stephan Beyer
@ 2008-07-16  2:26 ` Stephan Beyer
  2008-07-16  2:33 ` Johannes Schindelin
  2008-07-16 21:36 ` Junio C Hamano
  2 siblings, 0 replies; 7+ messages in thread
From: Stephan Beyer @ 2008-07-16  2:26 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

I have to admit that the subject is pretty ambiguous.

Sorry :) I should go to bed.
  Stephan

-- 
Stephan Beyer <s-beyer@gmx.net>, PGP 0x6EDDD207FCC5040F

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] rebase-i: keep old parents when preserving merges
  2008-07-16  1:51 [PATCH] rebase-i: keep old parents when preserving merges Stephan Beyer
  2008-07-16  2:26 ` Stephan Beyer
@ 2008-07-16  2:33 ` Johannes Schindelin
  2008-07-16  9:43   ` Stephan Beyer
  2008-07-16 21:36 ` Junio C Hamano
  2 siblings, 1 reply; 7+ messages in thread
From: Johannes Schindelin @ 2008-07-16  2:33 UTC (permalink / raw)
  To: Stephan Beyer; +Cc: git

Hi,

On Wed, 16 Jul 2008, Stephan Beyer wrote:

> This patch fixes two issues for rebase -i with preserving
> merges of unrelated branches.

Two?  What's the second?

Patch is obviously good.

Thanks,
Dscho

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] rebase-i: keep old parents when preserving merges
  2008-07-16  2:33 ` Johannes Schindelin
@ 2008-07-16  9:43   ` Stephan Beyer
  2008-07-16 10:24     ` Johannes Schindelin
  0 siblings, 1 reply; 7+ messages in thread
From: Stephan Beyer @ 2008-07-16  9:43 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

Hi,

Johannes Schindelin wrote:
> Hi,
> 
> On Wed, 16 Jul 2008, Stephan Beyer wrote:
> 
> > This patch fixes two issues for rebase -i with preserving
> > merges of unrelated branches.
> 
> Two?  What's the second?

Oh, eh, well ;)
It's only one bug, but it results in two different behaviors...
If you have a merge with more than two parents and not all are lost,
then it merges with too few parents.
If you have a merge with exactly two parents and one is lost, then
it tries to cherry-pick (with an error).
"Two" "issues" :)

Regards.
  Stephan

-- 
Stephan Beyer <s-beyer@gmx.net>, PGP 0x6EDDD207FCC5040F

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] rebase-i: keep old parents when preserving merges
  2008-07-16  9:43   ` Stephan Beyer
@ 2008-07-16 10:24     ` Johannes Schindelin
  0 siblings, 0 replies; 7+ messages in thread
From: Johannes Schindelin @ 2008-07-16 10:24 UTC (permalink / raw)
  To: Stephan Beyer; +Cc: git

Hi,

On Wed, 16 Jul 2008, Stephan Beyer wrote:

> Johannes Schindelin wrote:
> 
> > On Wed, 16 Jul 2008, Stephan Beyer wrote:
> > 
> > > This patch fixes two issues for rebase -i with preserving merges of 
> > > unrelated branches.
> > 
> > Two?  What's the second?
> 
> Oh, eh, well ;)
> It's only one bug, but it results in two different behaviors...

Ah, okay.  Worthwhile clarifying in the commit message.

Thanks for the patch,
Dscho

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] rebase-i: keep old parents when preserving merges
  2008-07-16  1:51 [PATCH] rebase-i: keep old parents when preserving merges Stephan Beyer
  2008-07-16  2:26 ` Stephan Beyer
  2008-07-16  2:33 ` Johannes Schindelin
@ 2008-07-16 21:36 ` Junio C Hamano
  2008-07-16 21:51   ` Stephan Beyer
  2 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2008-07-16 21:36 UTC (permalink / raw)
  To: Stephan Beyer; +Cc: Johannes Schindelin, git

Stephan Beyer <s-beyer@gmx.net> writes:

... Based on the discussion thread, here is a rewrite of the log message.

> 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 <s-beyer@gmx.net>
>
> 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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] rebase-i: keep old parents when preserving merges
  2008-07-16 21:36 ` Junio C Hamano
@ 2008-07-16 21:51   ` Stephan Beyer
  0 siblings, 0 replies; 7+ messages in thread
From: Stephan Beyer @ 2008-07-16 21:51 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Johannes Schindelin, git

Hi,

Junio C Hamano wrote:
> Stephan Beyer <s-beyer@gmx.net> writes:
> 
> ... Based on the discussion thread, here is a rewrite of the log message.
> 
> > 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 <s-beyer@gmx.net>

Ok, big thanks :)

> > 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 <s-beyer@gmx.net>, PGP 0x6EDDD207FCC5040F

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-07-16 21:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-16  1:51 [PATCH] rebase-i: keep old parents when preserving merges Stephan Beyer
2008-07-16  2:26 ` Stephan Beyer
2008-07-16  2:33 ` Johannes Schindelin
2008-07-16  9:43   ` Stephan Beyer
2008-07-16 10:24     ` Johannes Schindelin
2008-07-16 21:36 ` Junio C Hamano
2008-07-16 21:51   ` Stephan Beyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).