shithub: git9

Download patch

ref: e647dad43dbff501fd7a881fd785768292cc41d1
parent: 401b0b37b76813796e5740c0ef70834cb997a466
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Oct 24 16:40:31 EDT 2020

git/compat: exit with empty status

If we fell off the end of the script, we'd exit
with whatever status happened to be last. This
is a bug, so now if cmd_foo exits, we exit
the script with a successful status.

--- a/compat
+++ b/compat
@@ -131,21 +131,23 @@
 }
 
 fn die {
-	>[1=2] echo $*
-	exit boom
+	>[1=2] echo git $_cmdname: $*
+	exit $_cmdname: $*
 }
 
+_cmdname=$1
 if(~ $0 *compat){
 	ramfs -m /n/gitcompat
-	cp $0 /n/gitcompat/git
+	touch /n/gitcompat/git
+	bind $0 /n/gitcompat/git
 	path=( /n/gitcompat $path )
 	exec rc
 }
 
-if(! test -f '/env/fn#cmd_'$1){
+if(! test -f '/env/fn#cmd_'$1)
 	die git $1: commmand not implemented
-}
-
 if(! ~ $1 init && ! ~ $1 clone)
 	gitroot=`{git/conf -r} || die repo
+
 cmd_$1 $*(2-)
+exit ''