aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/sendemail-validate
blob: 024506fb9ab206b7dc601bf8e56ab29a04a9b5ef (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/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 --empty=drop "$email" ||
	die "Failed to apply patch on current upstream master branch. git pull --rebase?"
if ! git -C "$tmp" diff --quiet origin/master; then
	# patch is empty (cover letter)
	exit 0
fi
make -sC "$tmp" all lint tests check-patches ||
	die "Please fix the above issues and amend your patch."