shithub: git9

ref: 22383ae54cfeb178b150dc9417b0d773cc72c434
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

if(~ $#rel 0)
	rel=''
for(f in `{walk -f $gitrel/$*}){
	if(! ~ `{cleanname $f} .git/*){
		addpath=.git/index9/$add/$f
		delpath=.git/index9/$del/$f
		mkdir -p `{basename -d $addpath}
		mkdir -p `{basename -d $delpath}
		if(! test -e $addpath)
			walk -eq $f > $addpath
		rm -f $delpath
	}
}