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.
This commit is contained in:
Ori Bernstein 2021-06-05 17:42:05 +00:00
parent 5d06e7ad66
commit a5282f9eab

View file

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