shithub: shithub

ref: c0cc6b7980e6edce32822857a6a34dea390c4e90
dir: /branches/

View raw version
#!/bin/rc -e

. /sys/lib/shithub/common.rc

cd $1
shift

rfork ne
nl='
'

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

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

if(test -f $gitfs/$ref/hash)
	hash=`{cat $gitfs/$ref/hash}
if not
	hash=$ref

user_prelude $gituser $repo $hash

echo '	<h3>Branches</h3>
	<div>'

branches=`$nl{ls -Qp $gitfs/branch/heads}
if(~ $#branches 0){
	echo '<b>no branches found</b>'
	exit
}

for(branch in $branches){
	if(test -f $gitfs/branch/heads/$branch/hash){
		bhash=`{cat $gitfs/branch/heads/$branch/hash}
		echo '	<h4>'$branch'</h4>'
		formatcommit $gituser $repo $bhash
	}
}

echo '	</div>
	</body>
	</html>
'