shithub: plan9front

Download patch

ref: 706aad3d94ee4d9ff93c8c21398f0bb471a438da
parent: a5282f9eab1b78bd65e5144c81bf0f19b3f9efaf
author: glenda <glenda@9front.local>
date: Sat Jun 5 14:50:20 EDT 2021

git/branch: merge correct set of files

we were switching branches before we got the full list
of modified files, which could garble what we were trying
to merge.

--- a/sys/lib/git/common.rc	Sat Jun  5 13:42:05 2021
+++ b/sys/lib/git/common.rc	Sat Jun  5 14:50:20 2021
@@ -44,9 +44,9 @@
 	rfork e
 	n=$pid
 	out=$1
-	theirs=$2
+	ours=$2
 	base=$3
-	ours=$4
+	theirs=$4
 	tmp=$out.tmp
 	while(test -f $tmp){
 		tmp=$tmp.$n
@@ -70,8 +70,7 @@
 		rm -f $tmp $out
 		git/rm $out
 	}
-	}
-}
+}}
 
 fn gitup{
 	gitroot=`{git/conf -r >[2]/dev/null}
--- a/sys/src/cmd/git/branch	Sat Jun  5 13:42:05 2021
+++ b/sys/src/cmd/git/branch	Sat Jun  5 14:50:20 2021
@@ -60,9 +60,10 @@
 commit=`{git/query $base} || die 'branch does not exist:' $base
 if(~ $new */*)
 	mkdir -p .git/`{basename -d $new}
-echo $commit > .git/$new
-if(! ~ $#stay 0)
+if(! ~ $#stay 0){
+	echo $commit > .git/$new
 	exit
+}
 basedir=`{git/query -p $base}
 dirtypaths=()
 cleanpaths=($modified $deleted)
@@ -79,6 +80,7 @@
 	mkdir -p $cleandirs
 	mkdir -p .git/index9/tracked/$cleandirs
 }
+echo $commit > .git/$new
 for(m in $cleanpaths){
 	# Modifications can turn a file into
 	# a directory, or vice versa, so we