Git: git9

git9 @ eebc340fc005b8ccd63b02813c0df4bc6e160e8c

#!/bin/rc
rfork en
. /sys/lib/git/common.rc

gitup

flagfmt='c:query query' args='file ...'
eval `''{aux/getflags $*} || exec aux/usage

commit=$gitfs/HEAD
if(~ $#query 1)
	commit=`{git/query -p $query}

files=`$nl{cleanname -d $gitrel $* | drop $gitroot}
for(f in `$nl{cd $commit/tree/ && walk -f ./$files}){
	mkdir -p `{basename -d $f}
	cp -x -- $commit/tree/$f $f
	git/add $f
}
exit ''