From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeff King Subject: Re: [PATCH 2/2] commit: use a priority queue in merge base functions Date: Wed, 29 Aug 2012 17:05:40 -0400 Message-ID: <20120829210540.GA31756@sigill.intra.peff.net> References: <20120829110812.GA14069@sigill.intra.peff.net> <20120829111147.GB14734@sigill.intra.peff.net> <7vtxvlwt7o.fsf@alter.siamese.dyndns.org> <20120829205332.GA16064@sigill.intra.peff.net> <20120829205525.GA28696@sigill.intra.peff.net> <20120829210032.GA29179@sigill.intra.peff.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Cc: git@vger.kernel.org, Thomas Rast To: Junio C Hamano X-From: git-owner@vger.kernel.org Wed Aug 29 23:05:54 2012 Return-path: Envelope-to: gcvg-git-2@plane.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1T6pSS-00078s-Uv for gcvg-git-2@plane.gmane.org; Wed, 29 Aug 2012 23:05:53 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753525Ab2H2VFq (ORCPT ); Wed, 29 Aug 2012 17:05:46 -0400 Received: from 75-15-5-89.uvs.iplsin.sbcglobal.net ([75.15.5.89]:47385 "EHLO peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753361Ab2H2VFq (ORCPT ); Wed, 29 Aug 2012 17:05:46 -0400 Received: (qmail 2179 invoked by uid 107); 29 Aug 2012 21:06:02 -0000 Received: from sigill.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.7) (smtp-auth username relayok, mechanism cram-md5) by peff.net (qpsmtpd/0.84) with ESMTPA; Wed, 29 Aug 2012 17:06:02 -0400 Received: by sigill.intra.peff.net (sSMTP sendmail emulation); Wed, 29 Aug 2012 17:05:40 -0400 Content-Disposition: inline In-Reply-To: <20120829210032.GA29179@sigill.intra.peff.net> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: On Wed, Aug 29, 2012 at 05:00:32PM -0400, Jeff King wrote: > > Hmm, this does seem to break t6024 for me, though. > > Probably because: > > > /* Clean up the result to remove stale ones */ > > - free_commit_list(list); > > - list = result; result = NULL; > > - while (list) { > > - struct commit_list *next = list->next; > > - if (!(list->item->object.flags & STALE)) > > - commit_list_insert_by_date(list->item, &result); > > - free(list); > > - list = next; > > - } > > - return result; > > + while (result.nr) > > + commit_list_append(queue_pop(&result), &tail); > > + queue_clear(&result); > > + queue_clear(&list); > > + return ret; > > I forgot to to port the STALE flag handling here. You would want this on top: diff --git a/commit.c b/commit.c index c64ef94..8259871 100644 --- a/commit.c +++ b/commit.c @@ -661,8 +661,11 @@ static struct commit_list *merge_bases_many(struct commit *one, int n, struct co } /* Clean up the result to remove stale ones */ - while (result.nr) - commit_list_append(queue_pop(&result), &tail); + while (result.nr) { + struct commit *commit = queue_pop(&result); + if (!(commit->object.flags & STALE)) + commit_list_append(commit, &tail); + } queue_clear(&result); queue_clear(&list); return ret; but t6024 still fails (it clearly is finding a different merge base than the test expects). I'll trace through it, but it will have to be later tonight. -Peff