shithub: riscv

Download patch

ref: 970d3b7eb7dc56aa84924dd68c4c39fd1df5d1f5
parent: 474c03a439abac401dd71719de48631b9b3b8781
author: Ori Bernstein <ori@eigenstate.org>
date: Wed Nov 22 14:48:58 EST 2023

git/walk: skip all paths with '.git/' when creating the index

--- a/sys/src/cmd/git/walk.c
+++ b/sys/src/cmd/git/walk.c
@@ -234,11 +234,17 @@
 	if(path == nil)
 		sysfatal("smprint: %r");
 
+	cleanname(path);
+	if(strncmp(path, ".git/", 5) == 0){
+		free(path);
+		return 0;
+	}
 	ret = 0;
 	isdir = d->qid.type & QTDIR;
-	cleanname(path);
-	if((printflg & Uflg) == 0 && !indexed(path, isdir))
+	if((printflg & Uflg) == 0 && !indexed(path, isdir)){
+		free(path);
 		return 0;
+	}
 	if(isdir){
 		ret = loadwdir(path);
 		free(path);
@@ -267,7 +273,6 @@
 	d = nil;
 	e = nil;
 	ret = -1;
-
 	cleanname(path);
 	if(strncmp(path, ".git/", 5) == 0)
 		return 0;