shithub: git9

Download patch

ref: 32f41dd6f92251af8bf2c8657b46593505ad530e
parent: aa4d34b09ceeb3436bf4a7b7f2548ab1fe1ea657
author: Michael Forney <mforney@mforney.org>
date: Tue Jan 26 18:43:07 EST 2021

git/walk: update index9 qids when the files have the same data

This makes subsequent walks much faster.

--- a/walk.c
+++ b/walk.c
@@ -161,6 +161,18 @@
 	return 0;
 }
 
+void
+writeqid(Dir *d, char *qf)
+{
+	int fd;
+
+	if((fd = create(qf, OWRITE, 0666)) == -1)
+		return;
+	fprint(fd, "%ullx.%uld.%.2uhhx\n",
+		d->qid.path, d->qid.vers, d->qid.type);
+	close(fd);
+}
+
 int
 samedata(char *pa, char *pb)
 {
@@ -296,6 +308,7 @@
 			}else if(samedata(p, bpath)){
 				if(!quiet && (printflg & Tflg))
 					print("%s%s\n", tstr, p);
+				writeqid(d, tpath);
 			}else{
 				dirty |= Mflg;
 				if(!quiet && (printflg & Mflg))