From d55a64c90512aae66b5cabac57edc3e957bd3f0c Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Thu, 17 Mar 2022 01:41:44 +0000 Subject: [PATCH] git: use commit date as traversal hint instead of author date Although git9 always uses the same commit date and author date, other implementation do make a distinction. Since commit date is more representative of the commit graph order, use this as a traversal hint instead of author date. --- sys/src/cmd/git/git.h | 2 +- sys/src/cmd/git/util.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/src/cmd/git/git.h b/sys/src/cmd/git/git.h index cc39542dc..4e74333c5 100644 --- a/sys/src/cmd/git/git.h +++ b/sys/src/cmd/git/git.h @@ -158,7 +158,7 @@ struct Objset { struct Qelt { Object *o; - vlong mtime; + vlong ctime; int color; }; diff --git a/sys/src/cmd/git/util.c b/sys/src/cmd/git/util.c index 529dda41d..1d2398a7e 100644 --- a/sys/src/cmd/git/util.c +++ b/sys/src/cmd/git/util.c @@ -349,9 +349,9 @@ qput(Objq *q, Object *o, int color) } q->heap[q->nheap].o = o; q->heap[q->nheap].color = color; - q->heap[q->nheap].mtime = o->commit->mtime; + q->heap[q->nheap].ctime = o->commit->ctime; for(i = q->nheap; i > 0; i = (i-1)/2){ - if(q->heap[i].mtime < q->heap[(i-1)/2].mtime) + if(q->heap[i].ctime < q->heap[(i-1)/2].ctime) break; t = q->heap[i]; q->heap[i] = q->heap[(i-1)/2]; @@ -378,9 +378,9 @@ qpop(Objq *q, Qelt *e) m = i; l = 2*i+1; r = 2*i+2; - if(l < q->nheap && q->heap[m].mtime < q->heap[l].mtime) + if(l < q->nheap && q->heap[m].ctime < q->heap[l].ctime) m = l; - if(r < q->nheap && q->heap[m].mtime < q->heap[r].mtime) + if(r < q->nheap && q->heap[m].ctime < q->heap[r].ctime) m = r; if(m == i) break;