shithub: git9

Download patch

ref: 02199f94227871b32a4019292bdf1c731be99cee
parent: c5c45f287d855c721e03018086a17e5bf2fc1dd2
author: Ori Bernstein <[email protected]>
date: Wed Mar 4 16:51:18 EST 2020

improve git/add -r: remove nonexistent files

	git/add used to implicitly walk all args.
	this is great for adding files, which should
	really exist, but often people remove files
	and then realize they want them out of git
	too. This change walks the files only if
	they already exit.

--- a/add
+++ b/add
@@ -26,7 +26,12 @@
 
 if(~ $#rel 0)
 	rel=''
-for(f in `{walk -f $gitrel/$*}){
+if(~ $add tracked)
+	files=`$nl{walk -f $gitrel/$*}
+if not
+	files=`$nl{cd .git/index9/tracked/ && walk -f $gitrel/$*}
+
+for(f in $files){
 	if(! ~ `{cleanname $f} .git/*){
 		addpath=.git/index9/$add/$f
 		delpath=.git/index9/$del/$f