shithub: gitonline

Download patch

ref: c4d63487474d093a3e2d51437396cea5fd8c2080
parent: 4f773ce2220a75ca15504654b3a2c5c4c906ee7d
author: Peter Mikkelsen <petermikkelsen10@gmail.com>
date: Mon May 31 19:06:32 EDT 2021

Try to adapt to the new mountpoint of git/fs

--- a/gitonline.rc	Sun Jan 24 16:56:46 2021
+++ b/gitonline.rc	Mon May 31 19:06:32 2021
@@ -13,9 +13,9 @@
 fn resolveref {
 	if(~ $gitref HEAD)
 		echo $gitref
-	if not if(test -d /mnt/git/branch/$gitref/tree)
+	if not if(test -d $gitfs/branch/$gitref/tree)
 		echo branch/$gitref
-	if not if(test -d /mnt/git/object/$gitref/tree)
+	if not if(test -d $gitfs/object/$gitref/tree)
 		echo object/$gitref
 	if not {
 		status='bad ref'
@@ -84,12 +84,13 @@
 		cd $REPO_DIR
 		if (test -d $d/.git) {
 			cd $d
+			gitfs=$REPO_DIR/$d/.git/fs
 			git/fs
 			echo '
 	<tr>
 		<td><a href="/'$d'">'$d'</a></td>
 		<td>'
-		htcat /mnt/git/HEAD/msg | sed 1q
+		htcat $gitfs/HEAD/msg | sed 1q
 		echo '
 		</td>
 	</tr>'
@@ -147,7 +148,7 @@
 		echo '<b>'$status'</b>'
 	}
 	if not {
-		gitpath=/mnt/git/$ref/tree$filepath
+		gitpath=$gitfs/$ref/tree$filepath
 		if (test -d $gitpath) {
 			cd $gitpath
 			files=`$nl{ls -F | sed 's/\*//g'}
@@ -184,7 +185,7 @@
 	git/fs
 	ref=`{resolveref $gitref}
 	if (ref=`{resolveref $gitref}) {
-		cat /mnt/git/$ref/tree$filepath
+		cat $gitfs/$ref/tree$filepath
 	}
 }
 
@@ -206,13 +207,13 @@
 				<th>Short message</th>
 				<th>Commit hash</th>
 			</tr>'
-		commithash=`{cat /mnt/git/$ref/hash | sed 1q}
+		commithash=`{cat $gitfs/$ref/hash | sed 1q}
 		count=()
 		while (! ~ $#commithash 0 && ! ~ $#count $commitcount) {
 			count=($count 1)
-			message=`{htcat /mnt/git/object/$commithash/msg | sed 1q}
-			date=`{date -i `{mtime /mnt/git/object/$commithash/msg | awk '{print $1}'}}
-			author=`"{htcat /mnt/git/object/$commithash/author | awk '{print $1}'}
+			message=`{htcat $gitfs/object/$commithash/msg | sed 1q}
+			date=`{date -i `{mtime $gitfs/object/$commithash/msg | awk '{print $1}'}}
+			author=`"{htcat $gitfs/object/$commithash/author | awk '{print $1}'}
 			echo '
 			<tr>
 				<td>'$date'</td>
@@ -220,7 +221,7 @@
 				<td>'$"message'</td>
 				<td><a href="/'$repo'/showcommit/'$commithash'">'$commithash'</a></td>
 			</tr>'
-			commithash=`{cat /mnt/git/object/$commithash/parent | sed 1q}
+			commithash=`{cat $gitfs/object/$commithash/parent | sed 1q}
 		}
 		echo '</table>'
 	}
@@ -245,10 +246,10 @@
 		html_emit_end
 		exit
 	}
-	oldcommit=`{cat /mnt/git/$ref/parent}
-	author=`''{htcat /mnt/git/$ref/author}
-	date=`''{date `{mtime /mnt/git/$ref/msg | awk '{print $1}'}}
-	msg=`''{htcat /mnt/git/$ref/msg}
+	oldcommit=`{cat $gitfs/$ref/parent}
+	author=`''{htcat $gitfs/$ref/author}
+	date=`''{date `{mtime $gitfs/$ref/msg | awk '{print $1}'}}
+	msg=`''{htcat $gitfs/$ref/msg}
 	echo '
 	<table>
 	<tr><td><b>Commit:</b></td><td>'$commithash' (<a href="/'$repo'/browse/'$commithash'/">browse</a>)</td></tr>'
@@ -312,6 +313,7 @@
 	parts=`{echo $location | sed 's,/(.*)/showcommit/([^/]*),\1 \2,'}
 	repo=$parts(1)
 	commithash=$parts(2)
+	gitfs=$REPO_DIR/$repo/.git/fs
 	show_commit
 }
 if not if (~ $location */browse/*/* ) {
@@ -319,6 +321,7 @@
 	repo=$parts(1)
 	gitref=$parts(2)
 	filepath=$parts(3)
+	gitfs=$REPO_DIR/$repo/.git/fs
 	repo_browse
 }
 if not if (~ $location */shortlog/*/* ) {
@@ -333,9 +336,11 @@
 	repo=$parts(1)
 	gitref=$parts(2)
 	filepath=$parts(3)
+	gitfs=$REPO_DIR/.git/fs
 	repo_raw
 }
 if not if (test -d $REPO_DIR$location/.git) {
+	gitfs=$REPO_DIR$location/.git/fs
 	repo_view $location
 }
 if not {