ref: 7c3ef1d4f6ff9b6dfcc96d4b0bce2c93cdc1d069
dir: /view/
#!/bin/rc . /sys/lib/shithub/common.rc cd $1 shift rfork ne nl=' ' gituser=$1 repo=$2 refname=$3 file=$4 repons $gituser $repo if(! ref=`{resolveref $refname}){ echo '<b>invalid ref '$refname'</b>' exit } cd $gitfs/$ref/tree if(~ $file '') file='.' hash=`{cat $gitfs/$ref/hash} http_response user_prelude $gituser $repo $hash echo ' <p> <b>ref:</b> <a href="'/$gituser/$repo/browse/$hash/'">'$hash'</a><br/> <b>raw:</b> <a href="'/$gituser/$repo/viewraw/$hash/$file'">view</a> </p>' if(test -f $file){ type=`{file -m $file} switch($type){ case text/* echo ' <pre id="code">' htcat $file echo ' </pre>' case image/* echo ' <br/><div><img src="'/$gituser/$repo/viewraw/$hash/$file'" /></div>' case * echo ' <p>Binary file not displayed</p>' } } echo ' </body> </html>'