From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 14544 invoked from network); 23 Jan 2022 15:54:55 -0000 Received: from 4ess.inri.net (216.126.196.42) by inbox.vuxu.org with ESMTPUTF8; 23 Jan 2022 15:54:55 -0000 Received: from mimir.eigenstate.org ([206.124.132.107]) by 4ess; Sun Jan 23 10:18:31 -0500 2022 Received: from abbatoir.myfiosgateway.com (pool-74-108-56-225.nycmny.fios.verizon.net [74.108.56.225]) by mimir.eigenstate.org (OpenSMTPD) with ESMTPSA id 2e6ca4e0 (TLSv1.2:ECDHE-RSA-AES256-SHA:256:NO) for <9front@9front.org>; Sun, 23 Jan 2022 07:17:54 -0800 (PST) Message-ID: <5BB1B8C66C44E67C7BF8E8F9BC683595@eigenstate.org> To: 9front@9front.org Date: Sun, 23 Jan 2022 10:17:52 -0500 From: ori@eigenstate.org In-Reply-To: <81393E6026E97B03CBD1F42837BCCE28@arrow> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: lossless CMS optimizer Subject: Re: [9front] [PATCH] git/query: leave range commits in topological order Reply-To: 9front@9front.org Precedence: bulk Quoth Michael Forney : > > This prevents commits from getting reordered incorrectly during rebase > or export. > --- > diff 108d74cb0a8d27e82550d2772ae64fd7748e151d bb59fa1f40b5e5756639480fc08e0f33c7e19019 > --- a/sys/src/cmd/git/ref.c Fri Jan 7 02:37:02 2022 > +++ b/sys/src/cmd/git/ref.c Sat Jan 22 16:39:21 2022 > @@ -51,26 +51,6 @@ > ev->p++; > } > > -int > -objdatecmp(void *pa, void *pb) > -{ > - Object *a, *b; > - int r; > - > - a = readobject((*(Object**)pa)->hash); > - b = readobject((*(Object**)pb)->hash); > - assert(a->type == GCommit && b->type == GCommit); > - if(a->commit->mtime == b->commit->mtime) > - r = 0; > - else if(a->commit->mtime < b->commit->mtime) > - r = -1; > - else > - r = 1; > - unref(a); > - unref(b); > - return r; > -} > - > void > push(Eval *ev, Object *o) > { > @@ -406,7 +386,7 @@ > range(Eval *ev) > { > Object *a, *b, *p, *q, **all; > - int nall, *idx, mark; > + int nall, *idx; > Objset keep, skip; > > b = pop(ev); > @@ -424,7 +404,6 @@ > all = nil; > idx = nil; > nall = 0; > - mark = ev->nstk; > osinit(&keep); > osinit(&skip); > osadd(&keep, a); > @@ -459,7 +438,6 @@ > nall++; > } > free(all); > - qsort(ev->stk + mark, ev->nstk - mark, sizeof(Object*), objdatecmp); > return 0; > error: > free(all); > looks good; if someone really wants sorted commits, the right way to go would be to add a 'sort' operator to the query mini-language. something like: git/query a..b @sort rather than baking it into the range itself.