shithub: riscv

Download patch

ref: a5282f9eab1b78bd65e5144c81bf0f19b3f9efaf
parent: 5d06e7ad66f2dad04f25948bcdc256f812c47590
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
+	}
 	}
 }
 
--