shithub: riscv

ref: f0ac2d01765f938a4f3656efef440cf2c1bca69d
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

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

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