git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix reduce_heads
@ 2008-07-14  4:07 Sverre Hvammen Johansen
  2008-07-14  9:30 ` Johannes Schindelin
  0 siblings, 1 reply; 4+ messages in thread
From: Sverre Hvammen Johansen @ 2008-07-14  4:07 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Miklos Vajna, git

Reduce_heads used by build in merge failed to find the correct
heads in cases where duplicate heads are specified.
---
This should fix the last breakage I found. ([PATCH/Test] Build in
merge is broken)
I have squashed in Miklos's fix and the two tests cases to protect this.

I have several other test cases that were used for the --ff-only patch
I worked on.
Many of the cases for that patch gives protection not currently in any of the
existing tests.  If there is interest for it I can squash them in as well.

 commit.c         |    8 +++++++-
 t/t7600-merge.sh |   22 ++++++++++++++++++++++
 2 files changed, 29 insertions(+), 1 deletions(-)

diff --git a/commit.c b/commit.c
index d20b14e..4cacf4c 100644
--- a/commit.c
+++ b/commit.c
@@ -746,8 +746,14 @@ struct commit_list *reduce_heads(struct commit_list *heads)
                struct commit_list *q, *base;

                num_other = 0;
+               for (q = heads; q != p; q = q->next) {
+                       if (p->item == q->item)
+                               break;
+               }
+               if (q != p)
+                       continue;
                for (q = heads; q; q = q->next) {
-                       if (p == q)
+                       if (p->item == q->item)
                                continue;
                        other[num_other++] = q->item;
                }
diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh
index 16f4608..80cfee6 100755
--- a/t/t7600-merge.sh
+++ b/t/t7600-merge.sh
@@ -465,4 +465,26 @@ test_expect_success 'merge log message' '

 test_debug 'gitk --all'

+test_expect_success 'merge c1 with c0, c2, c0, and c1' '
+       git reset --hard c1 &&
+       git config branch.master.mergeoptions "" &&
+       test_tick &&
+       git merge c0 c2 c0 c1 &&
+       verify_merge file result.1-5 &&
+       verify_parents $c1 $c2
+'
+
+test_debug 'gitk --all'
+
+test_expect_success 'merge c1 with c1 and c2' '
+       git reset --hard c1 &&
+       git config branch.master.mergeoptions "" &&
+       test_tick &&
+       git merge c1 c2 &&
+       verify_merge file result.1-5 &&
+       verify_parents $c1 $c2
+'
+
+test_debug 'gitk --all'
+
 test_done
-- 
Sverre Hvammen Johansen

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

* Re: [PATCH] Fix reduce_heads
  2008-07-14  4:07 [PATCH] Fix reduce_heads Sverre Hvammen Johansen
@ 2008-07-14  9:30 ` Johannes Schindelin
  2008-07-14 11:44   ` Miklos Vajna
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Schindelin @ 2008-07-14  9:30 UTC (permalink / raw)
  To: Sverre Hvammen Johansen; +Cc: Junio C Hamano, Miklos Vajna, git

Hi,

On Sun, 13 Jul 2008, Sverre Hvammen Johansen wrote:

> Reduce_heads used by build in merge failed to find the correct
> heads in cases where duplicate heads are specified.

I liked Junio's explanation better.

> This should fix the last breakage I found. ([PATCH/Test] Build in
> merge is broken)
> I have squashed in Miklos's fix and the two tests cases to protect this.

I'd rather not have it squashed in.  Miklos is a GSoC student, and at the 
end I want to show the shortlog to tell Google how he fared.

Unfortunately, Miklos is on holiday this week, so he cannot send a mail of 
his own.  Junio, could you fake a commit message with a sign-off for 
Miklos, or do you want me to do it?

Ciao,
Dscho

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

* Re: [PATCH] Fix reduce_heads
  2008-07-14  9:30 ` Johannes Schindelin
@ 2008-07-14 11:44   ` Miklos Vajna
  2008-07-14 11:57     ` Miklos Vajna
  0 siblings, 1 reply; 4+ messages in thread
From: Miklos Vajna @ 2008-07-14 11:44 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Sverre Hvammen Johansen, Junio C Hamano, git

[-- Attachment #1: Type: text/plain, Size: 406 bytes --]

On Mon, Jul 14, 2008 at 11:30:24AM +0200, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> Unfortunately, Miklos is on holiday this week, so he cannot send a mail of 
> his own.  Junio, could you fake a commit message with a sign-off for 
> Miklos, or do you want me to do it?

I'll go out tomorrow, so I can send that it today. Sorry for not sending
a proper patch for the first time. ;-)

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: [PATCH] Fix reduce_heads
  2008-07-14 11:44   ` Miklos Vajna
@ 2008-07-14 11:57     ` Miklos Vajna
  0 siblings, 0 replies; 4+ messages in thread
From: Miklos Vajna @ 2008-07-14 11:57 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Sverre Hvammen Johansen, Junio C Hamano, git

[-- Attachment #1: Type: text/plain, Size: 245 bytes --]

On Mon, Jul 14, 2008 at 01:44:53PM +0200, Miklos Vajna <vmiklos@frugalware.org> wrote:
> I'll go out tomorrow, so I can send that it today. Sorry for not sending
> a proper patch for the first time. ;-)

Ah, It's already in 'pu', so never mind.

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

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

end of thread, other threads:[~2008-07-14 11:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-14  4:07 [PATCH] Fix reduce_heads Sverre Hvammen Johansen
2008-07-14  9:30 ` Johannes Schindelin
2008-07-14 11:44   ` Miklos Vajna
2008-07-14 11:57     ` Miklos Vajna

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).