shithub: plan9front

Download patch

ref: ce30e785b1c7b836c6fc387314e34503fc10a91c
parent: fb15534c78d06bce19233da20c2fe1d23ad0c447
author: Ori Bernstein <ori@eigenstate.org>
date: Sun Jun 6 11:57:31 EDT 2021

git/branch: diff clean and dirty lists correctly

no spaces in our lists.

--- a/sys/src/cmd/git/branch	Sun Jun  6 09:27:33 2021
+++ b/sys/src/cmd/git/branch	Sun Jun  6 11:57:31 2021
@@ -66,13 +66,17 @@
 }
 basedir=`{git/query -p $base}
 dirtypaths=()
-cleanpaths=($modified $deleted)
 if(! ~ $#modified 0 || ! ~ $#deleted 0)
 	dirtypaths=`$nl{git/walk -cfRMA $modified $deleted}
-if(! ~ $#dirtypaths 0){
-	x=$nl^$cleanpaths
-	y=$nl^$dirtypaths
-	cleanpaths=`$nl{echo $"x$nl$"y | sort | uniq -u}
+if(! ~ $#modified 0 || ! ~ $#deleted 0)
+	dirtypaths=`$nl{git/walk -cfRMA $modified $deleted}
+if(~ $#dirtypaths 0)
+	cleanpaths=($modified $deleted)
+if not {
+	cleanpaths=()
+	for(p in $modified $deleted)
+		if(! ~ $p $dirtypaths)
+			cleanpaths=($cleanpaths $p)
 }
 
 echo $commit > .git/$new