ref: 7820b114e08c9bd1705a7b253034b69cfda1668e
parent: 14eff369ce49e1a4d0e8f12bc8861f6e26b59abc
author: glenda <[email protected]>
date: Mon Nov 30 06:52:58 EST 2020
Add link to raw file
--- a/gitonline.rc
+++ b/gitonline.rc
@@ -161,7 +161,9 @@
echo '</pre>'
}
if not if (test -f $gitpath) {
- echo '<code><pre class="code">'
+ echo '
+ <a href="/'$repo'/raw/'$gitref$filepath'">view raw</a>
+ <code><pre class="code">'
htcat $gitpath
echo '</pre></code>'
}
@@ -179,6 +181,16 @@
html_emit_end
}
+fn repo_raw {
+ echo
+ cd $repo
+ git/fs
+ ref=`{resolveref $gitref}
+ if (ref=`{resolveref $gitref}) {
+ cat /mnt/git/$ref/tree$filepath
+ }
+}
+
fn shortlog {
commitcount=$1
pwd=`{pwd}
@@ -318,6 +330,13 @@
gitref=$parts(2)
filepath=$parts(3)
repo_shortlog
+}
+if not if (~ $location */raw/*/*) {
+ parts=`{echo $location | sed 's,/(.*)/raw/([^/]*)(.*),\1 \2 \3,'}
+ repo=$parts(1)
+ gitref=$parts(2)
+ filepath=$parts(3)
+ repo_raw
}
if not if (test -d $REPO_DIR$location/.git) {
repo_view $location