summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2022-12-15 20:39:36 +0100
committerRobin Jarry <robin@jarry.cc>2022-12-15 20:42:46 +0100
commit6fb0bcff03999350127a5a88f45a64d2a306a918 (patch)
treef30902024786bf1a90bb0a9063a9980eaf3ab8e3
parentc381bbd4110031df32a5bbc3e3de8c5dc677a6e4 (diff)
downloadaerc-6fb0bcff03999350127a5a88f45a64d2a306a918.tar.gz
aerc-6fb0bcff03999350127a5a88f45a64d2a306a918.zip
sendemail-validate: add human readable recommendations
When the patch fails to apply, users may get an obscure error from git: error: sha1 information is lacking or useless (commands/msg/reply.go). error: could not build fake ancestor Add explicit error messages indicating what happened and what should be done. Signed-off-by: Robin Jarry <robin@jarry.cc>
-rwxr-xr-xcontrib/sendemail-validate14
1 files changed, 11 insertions, 3 deletions
diff --git a/contrib/sendemail-validate b/contrib/sendemail-validate
index 1d18e65c..be0c3ad3 100755
--- a/contrib/sendemail-validate
+++ b/contrib/sendemail-validate
@@ -2,10 +2,18 @@
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"
+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"
-make -sC "$tmp" check-patches all lint tests
+git -C "$tmp" am -q3 "$email" ||
+ die "Failed to apply patch on current upstream master branch. git pull --rebase?"
+make -sC "$tmp" check-patches all lint tests ||
+ die "Please fix the above issues and amend your patch."