shithub: riscv

ref: 990ceeef3bfd9d56e2e6dd39cf5ac185b1a2de08
dir: /sys/src/cmd/git/revert/

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

gitup

flagfmt='c:query query' args='file ...'
if (! eval `''{aux/getflags $*} || ~ $#* 0)
	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
	touch $f
	git/add $f
}
exit ''