shithub: riscv

ref: f70cf0b70eb2b9b6cdf7208bf775189c724eb446
dir: /sys/src/cmd/git/hist/

View raw version
#!/bin/rc
rfork ne

. /sys/lib/git/common.rc
gitup

fn dodiff {
	while(t=`{read}){
		h=$t(1)
		o=$gitfs/object/`{git/query $h~}
		c=$gitfs/object/$h
		echo 'Hash:' $h
		echo -n 'Date: '; date `{walk -em $c/msg}
		echo -n 'Author: '; cat $c/author
		echo -n 'Message: '; cat $c/msg
		echo
		for(f in $files){
			curr=$c/tree/$f
			prev=$o/tree/$f
			if(! test -e $curr)
				curr=/dev/null
			if(! test -e $prev)
				prev=/dev/null
			diff -u $prev $curr
		}
		echo
	}
}

if(~ $#* 0)
	die usage: $0 files...

files=`{cleanname $gitrel/$*}
git/log -s $files | dodiff