shithub: git9

ref: 76566d81a8e51d8d8255c9d6a8e7cd107fc6de01
dir: /export/

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

usage='
	git/export [query]
'

gitup

q=$*
if(~ $#q 0)
	q=HEAD
commits=`{git/query $q || die $status}

scratch=/tmp/gitexport.$pid
mkdir -p $scratch
mkdir $scratch/a $scratch/b
for(c in $commits){
	cp=`{git/query -p $c}
	pp=`{git/query -p $c'^'}

	@{
		rfork n
		cd $scratch
		bind $pp/tree a
		bind $cp/tree b
		
		echo From $c
		echo From: `{cat $cp/author}
		echo Date: `{date -m `{mtime $cp/author | awk '{print $1}'}}
		echo Subject: [PATCH] `{sed 1q $cp/msg}
		echo
		sed '1d' $cp/msg

		ape/diff -urN a b
	}
}
rm $scratch/a $scratch/b
rm $scratch