shithub: shithub

Download patch

ref: 292901494bf667690f315cbc511e38023842a2db
parent: 96e6ff2316cc9dee9cea2ff7fb1381353c72e08c
author: glenda <[email protected]>
date: Mon May 31 19:32:56 EDT 2021

all: look in .git/fs instead of /mnt/git

we moved it.

--- a/common.rc
+++ b/common.rc
@@ -14,9 +14,9 @@
 fn resolveref {
 	if(~ $refname HEAD)
 		echo $refname
-	if not if(test -d /mnt/git/branch/$refname/tree)
+	if not if(test -d $gitfs/branch/$refname/tree)
 		echo branch/$refname
-	if not if(test -d /mnt/git/object/$refname/tree)
+	if not if(test -d $gitfs/object/$refname/tree)
 		echo object/$refname
 	if not
 		status='bad ref'
@@ -25,6 +25,7 @@
 fn repons {
 	mntgen
 	mntgen /mnt/mnt
+	gitfs=/mnt/$repo/.git/fs
 	ramfs -m /mnt/tmp
 	bind /bin /mnt/bin
 	bind /rc /mnt/rc
@@ -34,7 +35,7 @@
 	bind $1/$2 /mnt/$repo
 	bind /mnt /
 	cd /mnt/$repo
-	git/fs -m /mnt/git
+	git/fs
 	mntgen /mnt/scratch
 	rfork m
 }
@@ -44,9 +45,9 @@
 	prepo=$2
 	phash=$3
 
-	message=`{htcat /mnt/git/object/$phash/msg | sed 1q}
-	date=`{date -t `{mtime /mnt/git/object/$phash/msg | awk '{print $1}'}}
-	author=`"{htcat /mnt/git/object/$phash/author | awk '{print $1}'}
+	message=`{htcat $gitfs/object/$phash/msg | sed 1q}
+	date=`{date -t `{mtime $gitfs/object/$phash/msg | awk '{print $1}'}}
+	author=`"{htcat $gitfs/object/$phash/author | awk '{print $1}'}
 	shorthash=`{echo $phash | awk '{print substr($0, 0, 8)}'}
 	echo '	<div id="commit">
 		<a href=/'$puser/$prepo/$phash'/commit.html>'$shorthash'</a>
@@ -62,13 +63,13 @@
 	pcount=$4
 
 	d=`{pwd}
-	commithash=`{cat /mnt/git/$pref/hash | sed 1q}
+	commithash=`{cat $gitfs/$pref/hash | sed 1q}
 	count=()
 	while (! ~ $#commithash 0 && ! ~ $#count $pcount) {
 		count=($count 1)
 		formatcommit $puser $prepo $commithash
 		echo '<br/>'
-		commithash=`{cat /mnt/git/object/$commithash/parent | sed 1q}
+		commithash=`{cat $gitfs/object/$commithash/parent | sed 1q}
 	}
 	if(! ~ $"commithash '')
 		echo '<a href="/'$puser/$prepo/$commithash'/log.html">Next</a>'
--- a/feed
+++ b/feed
@@ -9,10 +9,10 @@
 
 	d=`{pwd}
 	guid='http://shithub.us/git/'$puser/$prepo/$phash'/commit.html'
-	message=`{htcat /mnt/git/object/$phash/msg | sed 1q}
-	description=`''{htcat /mnt/git/object/$phash/msg}
-	date=`{date -m `{mtime /mnt/git/object/$phash/msg |awk '{print $1}'}}
-	author=`"{htcat /mnt/git/object/$phash/author |awk '{print $1}'}
+	message=`{htcat $gitfs/object/$phash/msg | sed 1q}
+	description=`''{htcat $gitfs/object/$phash/msg}
+	date=`{date -m `{mtime $gitfs/object/$phash/msg |awk '{print $1}'}}
+	author=`"{htcat $gitfs/object/$phash/author |awk '{print $1}'}
 	echo '	<item>
 		<guid>'$"guid'</guid>
 		<pubDate>'$"date'</pubDate>
@@ -42,8 +42,8 @@
 	exit
 }
 
-if(test -f /mnt/git/$ref/hash)
-	hash=`{cat /mnt/git/$ref/hash}
+if(test -f $gitfs/$ref/hash)
+	hash=`{cat $gitfs/$ref/hash}
 if not
 	hash=$ref
 
@@ -58,19 +58,19 @@
 	<language>en-us</language>
 '
 
-if(! test -d /mnt/git/$ref/tree){
+if(! test -d $gitfs/$ref/tree){
 	echo '	</channel>
 		</rss>
 	'
 	exit
 }
-cd /mnt/git/$ref/tree
-commithash=`{cat /mnt/git/HEAD/hash | sed 1q}
+cd $gitfs/$ref/tree
+commithash=`{cat $gitfs/HEAD/hash | sed 1q}
 count=()
 while (! ~ $#commithash 0 && ! ~ $#count 10) {
 	count=($count 1)
 	rssitem $gituser $repo $commithash
-	commithash=`{cat /mnt/git/object/$commithash/parent | sed 1q}
+	commithash=`{cat $gitfs/object/$commithash/parent | sed 1q}
 }
 echo '	</channel>
 	</rss>
--- a/files
+++ b/files
@@ -21,14 +21,14 @@
 	exit
 }
 
-if(test -f /mnt/git/$ref/hash)
-	hash=`{cat /mnt/git/$ref/hash}
+if(test -f $gitfs/$ref/hash)
+	hash=`{cat $gitfs/$ref/hash}
 if not
 	hash=$ref
 
 user_prelude $gituser $repo $hash
 
-if(! test -d /mnt/git/$ref/tree){
+if(! test -d $gitfs/$ref/tree){
 	echo '	<p>No code pushed</p>
 		</body>
 		</html>
@@ -36,7 +36,7 @@
 	exit
 }
 
-cd /mnt/git/$ref/tree
+cd $gitfs/$ref/tree
 
 echo '	<p>
 	<b>ref:</b> <a href="'/git/$gituser/$repo/$hash/files.html'">'$hash'</a><br/>
--- a/info
+++ b/info
@@ -20,8 +20,8 @@
 	exit
 }
 
-if(test -f /mnt/git/$ref/hash)
-	hash=`{cat /mnt/git/$ref/hash}
+if(test -f $gitfs/$ref/hash)
+	hash=`{cat $gitfs/$ref/hash}
 if not
 	hash=$ref
 
@@ -35,12 +35,12 @@
 echo '	</div>'
 
 
-if(test -f /mnt/git/object/$hash/msg){
+if(test -f $gitfs/object/$hash/msg){
 	echo '	<h3>Last commit</h3>'
 	formatcommit $gituser $repo $hash
 }
 
-cd /mnt/git/object/$hash/tree
+cd $gitfs/object/$hash/tree
 echo '	<h3>About</h3>
 	<pre id="desc">'
 if(test -f $repodir/README)
--- a/log
+++ b/log
@@ -20,14 +20,14 @@
 	exit
 }
 
-if(test -f /mnt/git/$ref/hash)
-	hash=`{cat /mnt/git/$ref/hash}
+if(test -f $gitfs/$ref/hash)
+	hash=`{cat $gitfs/$ref/hash}
 if not
 	hash=$ref
 
 user_prelude $gituser $repo $hash
 
-if(! test -d /mnt/git/$ref/tree){
+if(! test -d $gitfs/$ref/tree){
 	echo '	<p>No commits yet.</p>
 		</body>
 		</html>
@@ -34,7 +34,7 @@
 	'
 	exit
 }
-cd /mnt/git/$ref/tree
+cd $gitfs/$ref/tree
 echo '	<p>
 	<a href="/'$gituser/$repo'/HEAD/feed.rss">RSS feed</a>
 	</p>
--- a/show
+++ b/show
@@ -22,10 +22,10 @@
 
 user_prelude $gituser $repo $refname
 
-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 '	<p>
 	<a href="/'$gituser/$repo/$refname'/patch">Download patch</a><br/>
 	</p>
--- a/tar
+++ b/tar
@@ -18,6 +18,6 @@
 	echo '<b>invalid ref '$refname'</b>'
 	exit
 }
-bind /mnt/git/$ref/tree /mnt/$repo
+bind $gitfs/$ref/tree /mnt/$repo
 cd /mnt
 tar cz $repo
--- a/view
+++ b/view
@@ -19,10 +19,10 @@
 	echo '<b>invalid ref '$refname'</b>'
 	exit
 }
-cd /mnt/git/$ref/tree
+cd $gitfs/$ref/tree
 if(~ $file '')
 	file='.'
-hash=`{cat /mnt/git/$ref/hash}
+hash=`{cat $gitfs/$ref/hash}
 
 user_prelude $gituser $repo $hash