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.
This commit is contained in:
glenda 2021-06-05 18:50:20 +00:00
parent a5282f9eab
commit 706aad3d94
6 changed files with 7 additions and 6 deletions

View file

@ -44,9 +44,9 @@ fn merge1 {@{
rfork e rfork e
n=$pid n=$pid
out=$1 out=$1
theirs=$2 ours=$2
base=$3 base=$3
ours=$4 theirs=$4
tmp=$out.tmp tmp=$out.tmp
while(test -f $tmp){ while(test -f $tmp){
tmp=$tmp.$n tmp=$tmp.$n
@ -70,8 +70,7 @@ fn merge1 {@{
rm -f $tmp $out rm -f $tmp $out
git/rm $out git/rm $out
} }
} }}
}
fn gitup{ fn gitup{
gitroot=`{git/conf -r >[2]/dev/null} gitroot=`{git/conf -r >[2]/dev/null}

0
sys/src/cmd/git/add Executable file → Normal file
View file

View file

@ -60,9 +60,10 @@ if(~ $#newbr 0){
commit=`{git/query $base} || die 'branch does not exist:' $base commit=`{git/query $base} || die 'branch does not exist:' $base
if(~ $new */*) if(~ $new */*)
mkdir -p .git/`{basename -d $new} mkdir -p .git/`{basename -d $new}
echo $commit > .git/$new if(! ~ $#stay 0){
if(! ~ $#stay 0) echo $commit > .git/$new
exit exit
}
basedir=`{git/query -p $base} basedir=`{git/query -p $base}
dirtypaths=() dirtypaths=()
cleanpaths=($modified $deleted) cleanpaths=($modified $deleted)
@ -79,6 +80,7 @@ if(! ~ $#cleandirs 0){
mkdir -p $cleandirs mkdir -p $cleandirs
mkdir -p .git/index9/tracked/$cleandirs mkdir -p .git/index9/tracked/$cleandirs
} }
echo $commit > .git/$new
for(m in $cleanpaths){ for(m in $cleanpaths){
# Modifications can turn a file into # Modifications can turn a file into
# a directory, or vice versa, so we # a directory, or vice versa, so we

0
sys/src/cmd/git/commit Executable file → Normal file
View file

0
sys/src/cmd/git/diff Executable file → Normal file
View file

0
sys/src/cmd/git/rebase Executable file → Normal file
View file