#!/bin/sh set -e die() { echo "error: $*" >&2 exit 1 } email="${1?email file}" tmp=$(mktemp -d) trap "rm -rf -- $tmp" EXIT git clone -q --depth=1 "https://git.sr.ht/~rjarry/aerc" "$tmp" || die "Failed to clone upstream repository. No network connection?" export GIT_DIR="$tmp/.git" git -C "$tmp" am -q3 "$email" || die "Failed to apply patch on current upstream master branch. git pull --rebase?" make -sC "$tmp" all lint tests check-patches || die "Please fix the above issues and amend your patch."