ref: fba714a4e6425c9dd1e5a52c0716f53bb2589da7
parent: 1a9d78fef4f600087c0a22f837ce7c253cb9944f
author: Ori Bernstein <ori@eigenstate.org>
date: Sun Oct 15 13:05:00 EDT 2023
git/add: don't include paths in the .git directory git/add .git/foo would happily add files in the .git directory, leaving it to other tools to filter them out; we shouldn't do that. While we're in here, speed things up by not iterating over long lists of files, and allow removing files that have not yet been committed.
--- a/sys/src/cmd/git/add
+++ b/sys/src/cmd/git/add
@@ -14,10 +14,6 @@
exec aux/usage
paths=`$nl{cleanname -d $gitrel $* | drop $gitroot}
-if(~ $s A)
- files=`$nl{walk -f ./$paths}
-if not
- files=`$nl{cd .git/fs/HEAD/tree && walk -f ./$paths}
-for(f in $files)
- echo $s NOQID 0 $f >> .git/INDEX9
+walk -f ./$paths | grep -v '^(./)?.git/' | \
+ sed 's/^/'$s' NOQID 0 /' >> .git/INDEX9
exit ''
--
⑨