ref: a5a8a92adf39b1a4525d6b0ddebc75e6db03e5b3
parent: b9adc507d25ec5f41463d31ef54751c1180c3db2
author: Michael Forney <[email protected]>
date: Sat Jan 22 19:39:21 EST 2022
git/query: leave range commits in topological order This prevents commits from getting reordered incorrectly during rebase or export.
--- a/sys/src/cmd/git/ref.c
+++ b/sys/src/cmd/git/ref.c
@@ -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);