From 7ba72bb888fec31e9c28ffc53fb27b8b88a69205 Mon Sep 17 00:00:00 2001 From: glenda Date: Tue, 16 Mar 2021 21:08:58 +0000 Subject: init commit --- git/gitls | 203 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ git/gitrules | 4 ++ git/tcp17021 | 2 + git/tcp9418 | 2 + 4 files changed, 211 insertions(+) create mode 100755 git/gitls create mode 100644 git/gitrules create mode 100755 git/tcp17021 create mode 100755 git/tcp9418 (limited to 'git') diff --git a/git/gitls b/git/gitls new file mode 100755 index 0000000..8a0c904 --- /dev/null +++ b/git/gitls @@ -0,0 +1,203 @@ +#!/bin/rc -e + +cd $1 +shift +url=fulton.software +rfork ne +nl=' +' + +fn htcat { + sed ' + 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 ' + + + + + + + + git webls + + + ' +} + +switch($1){ +case 'tar' + repo=$2 + refname=$3 + @{ + repons $2 + if(! ref=`{resolveref $refname}){ + echo 'invalid ref '$refname'' + exit + } + bind /mnt/git/$ref/tree /mnt/$repo + cd /mnt + tar cz $repo + } + +case 'list' + rfork m + prelude + echo '

Repos

+
' + for(repo in `$nl{ls}){ + if(test -e $repo/.git/webpublish){ + echo '
'$repo'
' + echo '
' + if(test -f $repo/.git/desc) + htcat $repo/.git/desc + if not + echo 'code some guy wrote' + echo '
' + } + } + echo '
' + +case 'info' + repo=$2 + repodir=/mnt/$repo/.git + refname=$3 + @{ + repons $repo + if(! ref=`{resolveref $refname}){ + echo 'invalid ref '$refname'' + exit + } + cd /mnt/git/$ref/tree + hash=`{cat /mnt/git/$ref/hash} + + prelude $repo $ref $repo + echo '

Git: '$repo'

+

'$repo' @ '$hash' +

'
+	htcat /mnt/git/object/$hash/msg
+	echo '	
+

Code

+

+ 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 '
+

About This Repo

+
'
+	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 '

Git: '$repo'

+

'$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 '	
+ + ' + } +} diff --git a/git/gitrules b/git/gitrules new file mode 100644 index 0000000..d01c8b1 --- /dev/null +++ b/git/gitrules @@ -0,0 +1,4 @@ +/repos.html /bin/gitls /usr/git list +/([^'/]+)/([^'/]+)/info.html /bin/gitls /usr/git info '\1' '\2' +/([^'/]+)/([^'/]+)/snap.tar.gz /bin/gitls /usr/git tar '\1' '\2' +/([^'/]+)/([^'/]+)/(([^']+)/)?f.html /bin/gitls /usr/git view '\1' '\2' '\4' diff --git a/git/tcp17021 b/git/tcp17021 new file mode 100755 index 0000000..03cff56 --- /dev/null +++ b/git/tcp17021 @@ -0,0 +1,2 @@ +#!/bin/rc +exec tlssrv -a /bin/git/serve -wr/usr/git diff --git a/git/tcp9418 b/git/tcp9418 new file mode 100755 index 0000000..6727baf --- /dev/null +++ b/git/tcp9418 @@ -0,0 +1,2 @@ +#!/bin/rc +exec git/serve -r/usr/git -- cgit 1.4.1-2-gfad0