shithub: git9

Download patch

ref: b896fc76bb3655028b97a1be943d316a98258698
parent: bc702cb015b3c2903ee03f5adf2852fc926633ed
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Jan 30 14:19:18 EST 2021

git/branch: fix branch switching

We were overeager filtering files for branch
switching. Now, get the full list of changes
and remove the locally-dirtied files, instead
of trying to filter for locally tracked files.

--- a/branch
+++ b/branch
@@ -65,12 +65,17 @@
 	exit
 
 basedir=`{git/query -p $base}
-cleanpaths=()
 dirtypaths=()
-if(! ~ $#modified 0 || ! ~ $#deleted 0){
-	cleanpaths=`$nl{git/walk -cfT $modified $deleted}
+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}
 }
+echo clean: $cleanpaths
+echo dirty: $dirtypaths
 for(m in $cleanpaths){
 	d=`{basename -d $m}
 	mkdir -p $d