git: 9front

Download patch

ref: 26a6c4ef229b379c8eb060afb302d09c6efefb94
parent: 6dd45599c2d3e982a4841d32a983a0710fcd5902
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Jun 5 13:42:05 EDT 2021

git/{branch,pull}: merge files correctly

merge1 would clobber the global '$base' variable,
which is not what we wanted. Run it in a subshell
with its own env.

--- a/sys/lib/git/common.rc
+++ b/sys/lib/git/common.rc
@@ -40,7 +40,8 @@
 }
 
 # merge1 out theirs base ours
-fn merge1 {
+fn merge1 {@{
+	rfork e
 	n=$pid
 	out=$1
 	theirs=$2
@@ -59,7 +60,7 @@
 	if(! test -f $theirs)
 		theirs=/dev/null
 	if(! ape/diff3 -3 -m $ours $base $theirs > $tmp)
-		echo merge needed: $out
+		echo merge needed: $out >[1=2]
 
 	if(present $ours $base $theirs){
 		mv $tmp $out
@@ -68,6 +69,7 @@
 	if not {
 		rm -f $tmp $out
 		git/rm $out
+	}
 	}
 }
 
--