shithub: riscv

Download patch

ref: dfee08d50df674cd76f74320bc9c8bc6a4a95f1e
parent: f9df0bd2821c302cb13b694842e802cd9e2bc402
author: Ori Bernstein <ori@eigenstate.org>
date: Fri Oct 21 11:27:14 EDT 2022

git/walk: don't list untracked files after removal

git/walk had some confusing behavior, where git/add
of a file and then immediate removal would leave
it in the list of files as 'removed'.

This was harmless, but confusing to users. Now,
'git/add' and 'git/rm' without a commit in between
will not list the file as removed.

--- a/sys/src/cmd/git/walk.c
+++ b/sys/src/cmd/git/walk.c
@@ -295,10 +295,12 @@
 			if(!quiet && (printflg & Tflg))
 				print("%s%s\n", tstr, p);
 		}else{
-			if(d == nil || access(rpath, AEXIST) == 0){
-				dirty |= Rflg;
-				if(!quiet && (printflg & Rflg))
-					print("%s%s\n", rstr, p);
+			if(d == nil || access(rpath, AEXIST) == 0 ){
+				if(access(bpath, AEXIST) == 0){
+					dirty |= Rflg;
+					if(!quiet && (printflg & Rflg))
+						print("%s%s\n", rstr, p);
+				}
 			}else if(access(bpath, AEXIST) == -1) {
 				dirty |= Aflg;
 				if(!quiet && (printflg & Aflg))