#!/bin/rc -e . /sys/lib/shithub/common.rc cd $1shift rfork nenl='' gituser=$1repo=$2refname=$3 repons $gituser $repoif(! 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 # list branches in order of last changebranches=`$nl{ls -Qt $gitfs/branch/heads/*/msg}if(! ~ $#branches 0){ echo -n ' <br><b>branches:</b>' for(b in $branches){ branch=`{basename `{basename -d $b}} if(test -f $gitfs/branch/heads/$branch/hash){ echo -n ' <a href="'/$gituser/$repo/$branch/info.html'">'$branch'</a>' } } echo ''} echo ' <h3>Clone</h3> <div> <b>clone:</b> git://'$host/$gituser/$repo' gits://'$host/$gituser/$repo'<br> <b>push:</b> hjgit://'$host/$gituser/$repo'<br>'if(test -f $repodir/contact) echo ' <b>patches to: </b>'^`$nl{cat $repodir/contact}^'<br>'echo ' </div>' if(test -f $gitfs/object/$hash/msg){ echo ' <h3>Last commit</h3>' formatcommit $gituser $repo $hash} cd $gitfs/object/$hash/treedescfiles=(README^(.plan9 '' .md) readme^(.plan9 '' .md) desc description)echo ' <h3>About</h3> <pre id="desc">'done=()for(f in $descfiles $repodir/^$descfiles) if(~ $#done 0 && test -f $f){ htcat $f done=1 }if(~ $#done 0) echo 'this repo has no description'echo ' </pre> </body> </html>'
#!/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
# list branches in order of last change
branches=`$nl{ls -Qt $gitfs/branch/heads/*/msg}
if(! ~ $#branches 0){
echo -n ' <br><b>branches:</b>'
for(b in $branches){
branch=`{basename `{basename -d $b}}
if(test -f $gitfs/branch/heads/$branch/hash){
echo -n ' <a href="'/$gituser/$repo/$branch/info.html'">'$branch'</a>'
}
}
echo ''
}
echo ' <h3>Clone</h3>
<div>
<b>clone:</b> git://'$host/$gituser/$repo' gits://'$host/$gituser/$repo'<br>
<b>push:</b> hjgit://'$host/$gituser/$repo'<br>'
if(test -f $repodir/contact)
echo ' <b>patches to: </b>'^`$nl{cat $repodir/contact}^'<br>'
echo ' </div>'
if(test -f $gitfs/object/$hash/msg){
echo ' <h3>Last commit</h3>'
formatcommit $gituser $repo $hash
}
cd $gitfs/object/$hash/tree
descfiles=(README^(.plan9 '' .md) readme^(.plan9 '' .md) desc description)
echo ' <h3>About</h3>
<pre id="desc">'
done=()
for(f in $descfiles $repodir/^$descfiles)
if(~ $#done 0 && test -f $f){
htcat $f
done=1
}
if(~ $#done 0)
echo 'this repo has no description'
echo '
</pre>
</body>
</html>
'