shithub: riscv

Download patch

ref: d55a64c90512aae66b5cabac57edc3e957bd3f0c
parent: 8bd5be7c707b979caa277637cadf356b78c2edb5
author: Michael Forney <mforney@mforney.org>
date: Wed Mar 16 21:41:44 EDT 2022

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.

--- a/sys/src/cmd/git/git.h
+++ b/sys/src/cmd/git/git.h
@@ -158,7 +158,7 @@
 
 struct Qelt {
 	Object	*o;
-	vlong	mtime;
+	vlong	ctime;
 	int	color;
 };
 
--- a/sys/src/cmd/git/util.c
+++ b/sys/src/cmd/git/util.c
@@ -349,9 +349,9 @@
 	}
 	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 @@
 		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;