shithub: riscv

ref: 46cf9d4eb02a3a7c2516be3053994d4fb69eb949
dir: /sys/src/cmd/git/add/

View raw version
#!/bin/rc -e
rfork ne
. /sys/lib/git/common.rc

gitup

flagfmt='r:remove'; args='file ...'
eval `''{aux/getflags $*} || exec aux/usage

s=A
if(~ $remove 1)
	s=R
if(~ $#* 0)
	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
exit ''