]> git.lizzy.rs Git - plan9front.git/commitdiff
git/{branch,pull}: merge files correctly
authorOri Bernstein <ori@eigenstate.org>
Sat, 5 Jun 2021 17:42:05 +0000 (17:42 +0000)
committerOri Bernstein <ori@eigenstate.org>
Sat, 5 Jun 2021 17:42:05 +0000 (17:42 +0000)
merge1 would clobber the global '$base' variable,
which is not what we wanted. Run it in a subshell
with its own env.

sys/lib/git/common.rc

index dbcef04bff3c53094353f3f1875667f55fd78423..edb95f7d13631ec75add34a6ee45637ff6fc1a44 100644 (file)
@@ -40,7 +40,8 @@ fn present {
 }
 
 # merge1 out theirs base ours
-fn merge1 {
+fn merge1 {@{
+       rfork e
        n=$pid
        out=$1
        theirs=$2
@@ -59,7 +60,7 @@ fn merge1 {
        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
@@ -69,6 +70,7 @@ fn merge1 {
                rm -f $tmp $out
                git/rm $out
        }
+       }
 }
 
 fn gitup{