die () # write error to stderr and exit
{
- [ $# -gt 0 ] && echo "$PN: $@" >&2
+ [ $# -gt 0 ] && echo "$PN: $*" >&2
exit 1
}
tempfile=/tmp/$PN.$$
fi
-trap "rm -f $tempfile 2> /dev/null" EXIT
+trap 'rm -f $tempfile 2> /dev/null' EXIT
[ -e Makefile ] && [ "$build" ] && {
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 ()
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
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
echo "Checking for remote changes..."
git fetch || die "fetch error"
-[ $(git rev-parse @{u}) = $rev ] || {
+[ "$(git rev-parse @{u})" = "$rev" ] || {
echo "Upstream has changed"
## 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"