* admin/automerge: Fix quoting of some variables.

This commit is contained in:
Stefan Kangas 2021-11-10 13:06:24 +01:00
parent 99abafdd0d
commit e3f5f5d867

View file

@ -37,7 +37,7 @@
die () # write error to stderr and exit
{
[ $# -gt 0 ] && echo "$PN: $@" >&2
[ $# -gt 0 ] && echo "$PN: $*" >&2
exit 1
}
@ -133,7 +133,7 @@ else
tempfile=/tmp/$PN.$$
fi
trap "rm -f $tempfile 2> /dev/null" EXIT
trap 'rm -f $tempfile 2> /dev/null' EXIT
[ -e Makefile ] && [ "$build" ] && {
@ -153,7 +153,7 @@ trap "rm -f $tempfile 2> /dev/null" EXIT
rev=$(git rev-parse HEAD)
[ $(git rev-parse @{u}) = $rev ] || die "Local state does not match origin"
[ "$(git rev-parse @{u})" = "$rev" ] || die "Local state does not match origin"
merge ()
@ -162,12 +162,12 @@ merge ()
if $emacs --batch -Q -l ./admin/gitmerge.el \
--eval "(setq gitmerge-minimum-missing $nmin)" -f gitmerge \
>| $tempfile 2>&1; then
>| "$tempfile" 2>&1; then
echo "merged ok"
return 0
else
grep -E "Nothing to merge|Number of missing commits" $tempfile && \
grep -E "Nothing to merge|Number of missing commits" "$tempfile" && \
exit 0
cat "$tempfile" 1>&2
@ -191,13 +191,13 @@ git diff --stat --cached origin/master | grep -q "etc/NEWS " && \
echo "Running autoreconf..."
autoreconf -i -I m4 2>| $tempfile
autoreconf -i -I m4 2>| "$tempfile"
retval=$?
## Annoyingly, autoreconf puts the "installing `./foo' messages on stderr.
if [ "$quiet" ]; then
grep -v 'installing `\.' $tempfile 1>&2
grep -v 'installing `\.' "$tempfile" 1>&2
else
cat "$tempfile" 1>&2
fi
@ -236,7 +236,7 @@ echo "Tests finished ok"
echo "Checking for remote changes..."
git fetch || die "fetch error"
[ $(git rev-parse @{u}) = $rev ] || {
[ "$(git rev-parse @{u})" = "$rev" ] || {
echo "Upstream has changed"
@ -245,7 +245,7 @@ git fetch || die "fetch error"
## Ref eg https://lists.gnu.org/r/emacs-devel/2014-12/msg01435.html
## Instead, we throw away what we just did, and do the merge again.
echo "Resetting..."
git reset --hard $rev
git reset --hard "$rev"
echo "Pulling..."
git pull --ff-only || die "pull error"