#!/bin/rc -e cd $1 shift url=fulton.software rfork ne nl=' ' fn htcat { sed ' s/&/\&/g; s/\</g; s/>/\>/g; s/"/\"/g; s/''/\'/g ' $* } fn resolveref { if(~ $refname HEAD) echo $refname if not if(test -d /mnt/git/branch/$refname/tree) echo branch/$refname if not if(test -d /mnt/git/object/$refname/tree) echo object/$refname if not status='bad ref' } fn repons { mntgen mntgen /mnt/mnt bind /bin /mnt/bin bind /tmp /mnt/tmp bind -c /env /mnt/env bind $1 /mnt/$repo bind /mnt / cd /mnt/$repo git/fs rfork m } fn prelude { echo '
'$repo' @ '$hash'
' htcat /mnt/git/object/$hash/msg echo '
clone: git://'$url'/'$repo', gits://'$url'/'$repo'
push: hjgit://'$url'/'$repo'
tar: snap.tar.gz
'
if(test -f $repodir/contact)
echo 'patches to: '^`$nl{cat $repodir/contact}^'
' for(f in `$nl{ls}){ url=`$nl{echo -n $f/f.html | urlencode} fname=`$nl{echo -n $f | htcat} echo ''$fname'' } echo '
' if(test -f $repodir/README) htcat $repodir/README if not if(test -f README) htcat README if not if (test -f README.md) htcat README.md if not if(test -f $repodir/desc) htcat $repodir/desc if not echo 'this repo has no description' echo '' } case 'view' repo=$2 repodir=/mnt/$repo/.git refname=$3 file=$4 @{ repons $repo if(! ref=`{resolveref $refname}){ echo 'invalid ref '$refname'' exit } cd /mnt/git/$ref/tree if(~ $file '') file='.' hash=`{cat /mnt/git/$ref/hash} prelude echo '
'$repo' @ '$hash'
' if(test -f $file){ htcat $file } if not if(test -d $file){ cd $file for(f in `$nl{ls}){ url=`$nl{echo -n $f/f.html | urlencode} fname=`$nl{echo -n $f | htcat} echo ''$fname'' } } echo '