shithub: git9

ref: e1e84b5214aac5d38263f5c8bfc4d88f698d68d6
dir: /add/

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

usage='
	git/add [-r] file ...
		-r        remove file
'

gitup

add='tracked'
del='removed'
while(~ $1 -* && ! ~ $1 --){
	switch($1){
	case -r
		add='removed'
		del='tracked'
	case *
		usage
	}
	shift
}
if(~ $1 --)
	shift

rel=`{sed 's@^'$gitroot'/*@@' <{echo $dir}}
if(~ $#rel 0)
	rel=''
for(f in $*){
	addpath=.git/index9/$add/$rel/$f
	delpath=.git/index9/$del/$rel/$f
	mkdir -p `{basename -d $addpath}
	mkdir -p `{basename -d $delpath}
	touch $addpath
	rm -f $delpath
}