old=$2
new=$3
libgo=$4
- if ! test -f ${new}; then
+ if test -d ${new}; then
+ if ! test -d ${old}; then
+ if test -f ${old}; then
+ echo 1>&2 "merge.sh: ${name}: FILE BECAME DIRECTORY"
+ fi
+ fi
+ elif ! test -f ${new}; then
# The file does not exist in the new version.
if ! test -f ${old}; then
echo 1>&2 "merge.sh internal error no files $old $new"
else
echo "merge.sh: ${name}: REMOVED"
rm -f ${libgo}
- git rm ${libgo}
fi
elif test -f ${old}; then
# The file exists in the old version.
if ! cmp -s ${old} ${new}; then
echo "merge.sh: $name: skipping: exists in old and new git, but not in libgo"
fi
- continue
+ return
fi
if cmp -s ${old} ${libgo}; then
# The libgo file is unchanged from the old version.
if cmp -s ${new} ${libgo}; then
# File is unchanged from old to new version.
- continue
+ return
fi
# Update file in libgo.
echo "merge.sh: $name: updating"
mkdir -p ${dir}
fi
cp ${new} ${libgo}
- git add ${libgo}
fi
fi
}
(cd ${NEWDIR}/src && find . -name '*.go' -print) | while read f; do
skip=false
case "$f" in
- ./cmd/cgo/* | ./cmd/go/* | ./cmd/gofmt/* | ./cmd/internal/browser/* | ./cmd/internal/objabi/*)
+ ./cmd/buildid/* | ./cmd/cgo/* | ./cmd/go/* | ./cmd/gofmt/* | ./cmd/test2json/* | ./cmd/vet/* | ./cmd/internal/browser/* | ./cmd/internal/buildid/* | ./cmd/internal/codesign/* | ./cmd/internal/edit/* | ./cmd/internal/objabi/* | ./cmd/internal/quoted/* | ./cmd/internal/test2json/* | ./cmd/internal/sys/* | ./cmd/internal/traceviewer/* | ./cmd/vendor/golang.org/x/tools/* | ./cmd/vendor/golang.org/x/mod/* | ./cmd/vendor/golang.org/x/xerrors/* | ./cmd/vendor/golang.org/x/crypto/ed25519 | ./cmd/vendor/golang.org/x/sync/semaphore)
;;
./cmd/*)
skip=true
oldfile=${OLDDIR}/src/$f
newfile=${NEWDIR}/src/$f
- libgofile=go/`echo $f | sed -e 's|/vendor/|/|'`
+ libgofile=go/`echo $f | sed -e 's|cmd/vendor/|/|' | sed -e 's|/vendor/|/|'`
+ merge $f ${oldfile} ${newfile} ${libgofile}
+done
+
+(cd ${NEWDIR}/src && find . -name 'go.mod' -print) | while read f; do
+ oldfile=${OLDDIR}/src/$f
+ newfile=${NEWDIR}/src/$f
+ libgofile=go/`echo $f | sed -e 's|cmd/vendor/|/|' | sed -e 's|/vendor/|/|'`
+ merge $f ${oldfile} ${newfile} ${libgofile}
+done
+
+(cd ${NEWDIR}/src && find . -name 'modules.txt' -print) | while read f; do
+ oldfile=${OLDDIR}/src/$f
+ newfile=${NEWDIR}/src/$f
+ libgofile=go/$f
merge $f ${oldfile} ${newfile} ${libgofile}
done
(cd ${NEWDIR}/src && find . -name testdata -print) | while read d; do
skip=false
case "$d" in
- ./cmd/cgo/* | ./cmd/go/* | ./cmd/gofmt/* | ./cmd/internal/browser/*)
+ ./cmd/buildid/* | ./cmd/cgo/* | ./cmd/go/* | ./cmd/gofmt/* | ./cmd/test2json/* | ./cmd/vet/* | ./cmd/internal/browser/* | ./cmd/internal/buildid/* | ./cmd/internal/codesign/* | ./cmd/internal/diff/* | ./cmd/internal/edit/* | ./cmd/internal/objabi/* | ./cmd/internal/test2json/* | ./cmd/internal/sys/* | ./cmd/internal/traceviewer/* | ./cmd/vendor/golang.org/x/tools/*)
;;
./cmd/*)
skip=true
;;
- ./runtime/race/*)
+ ./runtime/race/* | ./runtime/cgo/*)
skip=true
;;
esac
oldtd=${OLDDIR}/src/$d
newtd=${NEWDIR}/src/$d
- libgotd=go/$d
+ libgotd=go/`echo $d | sed -e 's|cmd/vendor/|/|' | sed -e 's|/vendor/|/|'`
if ! test -d ${oldtd}; then
echo "merge.sh: $d: NEWDIR"
continue
fi
(cd ${oldtd} && git ls-files .) | while read f; do
- if test "`basename $f`" = ".gitignore"; then
+ if test "`basename -- $f`" = ".gitignore"; then
continue
fi
name=$d/$f
libgofile=${libgotd}/$f
merge ${name} ${oldfile} ${newfile} ${libgofile}
done
+ (cd ${newtd} && git ls-files .) | while read f; do
+ if test "`basename -- $f`" = ".gitignore"; then
+ continue
+ fi
+ oldfile=${oldtd}/$f
+ if ! test -f ${oldfile}; then
+ name=$d/$f
+ newfile=${newtd}/$f
+ libgofile=${libgotd}/$f
+ merge ${name} ${oldfile} ${newfile} ${libgofile}
+ fi
+ done
done
(cd ${NEWDIR}/misc/cgo && find . -type f -print) | while read f; do
fi
echo "merge.sh: ${libgofile}: REMOVED"
rm -f ${libgofile}
- git rm ${libgofile}
done
(cd ${OLDDIR}/misc/cgo && find . -type f -print) | while read f; do
fi
echo "merge.sh: ${libgofile}: REMOVED"
rm -f ${libgofile}
- git rm ${libgofile}
done
(echo ${new_rev}; sed -ne '2,$p' MERGE) > MERGE.tmp