shithub: shithub

ref: 7c3ef1d4f6ff9b6dfcc96d4b0bce2c93cdc1d069
dir: /show/

View raw version
#!/bin/rc

. /sys/lib/shithub/common.rc

cd $1
shift

rfork ne
nl='
'

gituser=$1
repo=$2
refname=$3

repons $gituser $repo
repodir=/mnt/$repo/.git
if(! ref=`{resolveref $refname}){
	echo '<b>invalid ref '$refname'</b>'
	exit
}

http_response
user_prelude $gituser $repo $refname

oldcommit=`{cat $gitfs/$ref/parent}
author=`''{htcat $gitfs/$ref/author}
date=`''{date `{mtime $gitfs/$ref/msg | awk '{print $1}'}}
msg=`''{htcat $gitfs/$ref/msg}
echo '	<p>
	<a href="/'$gituser/$repo/patch/$refname'">Download patch</a><br/>
	</p>
	<p>
	<b>ref:</b> <a href="/'$gituser/$repo/browse/$refname'">'$refname'</a><br/>'
if(! ~ $#oldcommit 0) {
	echo '<b>parent:</b> <a href="/'$gituser/$repo/browse/$oldcommit'">'$oldcommit'</a><br/>'
}
echo '	<b>author:</b> '$author'<br/>
	<b>date:</b> '$date'
	<pre id="commit">'$msg'</pre><br/>
	</p>'
cd /mnt/$repo
echo '	<div id="diff">'
git/export $refname | htcat | difftohtml
echo '	</div>
	</body>
	</html>'