ref: 8000697e669a8c3b8ffed2df6c6c966727e8be9e
parent: 3edd9c1f0e4e47a06f5e4f96ce30414804057ccd
author: Ori Bernstein <ori@eigenstate.org>
date: Wed Nov 25 18:27:29 EST 2020
gitls: add support for untracked READMEs It's sometimes nice to provide a description or tutorial information for a repo, without littering the root of the repo with trash like README; this adds support for the gitls maintaner to put a file in the repo's .git directory.
--- a/extra/gitls
+++ b/extra/gitls
@@ -82,6 +82,7 @@
case 'info'
repo=$2
+ repodir=`{pwd}^/$repo/.git
refname=$3
@{
@@ -95,7 +96,7 @@
if(~ $file '')
file='.'
hash=`{cat /mnt/git/$ref/hash}
- echo '<h1>Git: <a href=/git/'$repo'/'$ref'/info.html>'$repo'</a></h1>'
+ echo '<h1><a href="/git/repos.html">Git</a>: <a href=/git/'$repo'/'$ref'/info.html>'$repo'</a></h1>'
echo '<p>'$file' @ <a href='/git/$repo/$hash/f.html'>'$hash'</a>'
echo '<pre id="desc">'
htcat /mnt/git/object/$hash/msg
@@ -109,10 +110,14 @@
}
echo '</pre>'
echo '<pre id="desc">'
- if(test -f README)
+ 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 '</pre>'
@@ -119,6 +124,7 @@
}
case 'view'
repo=$2
+ repodir=`{pwd}^/$repo/.git
refname=$3
file=$4
@@ -135,7 +141,7 @@
file='.'
hash=`{cat /mnt/git/$ref/hash}
- echo '<h1>Git: <a href=/git/'$repo'/'$hash'/info.html>'$repo'</a></h1>'
+ echo '<h1><a href="/git/repos.html">Git</a>: <a href=/git/'$repo'/'$hash'/info.html>'$repo'</a></h1>'
echo '<p>'$file' @ <a href='/git/$repo/$hash/f.html'>'$hash'</a>'
echo '<pre id="desc">'
htcat /mnt/git/object/$hash/msg