#!/bin/rc -e . /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 'invalid ref '$refname'' exit } cd $gitfs/$ref/tree if(~ $file '') file='.' hash=`{cat $gitfs/$ref/hash} user_prelude $gituser $repo $hash echo '
ref: '$hash'
'
echo $file | htcat | awk -F/ '{
user = ENVIRON["gituser"]
repo = ENVIRON["repo"]
hash = ENVIRON["hash"]
url="/" user "/" repo "/" hash
printf("dir: /", url);
for(i = 1; i <= NF; i++){
if($i != "."){
url=url"/"$i
printf("%s/", url, $i)
}
}
printf("
' htcat $file echo '' case image/* echo '
Binary file not displayed
' } } if not if(test -d $file){ cd $file echo '