aboutsummaryrefslogblamecommitdiffstats
path: root/contrib/sendemail-validate
blob: f334bff5bc424cc765bc49eccea348debf44de10 (plain) (tree)
1
2
3
4
5
6
7
8
9



         




                            
                       


                                            

                          

                                                                         
                          


                                                                                 
                                               
                                                               
#!/bin/sh

set -e

die() {
	echo "error: $*" >&2
	exit 1
}

email="${1?email file}"
# skip empty patches (cover letter)
grep -q "^diff --git " "$email" || exit 0
echo 'Cloning upstream repo in temp dir ...'
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 -3 "$email" ||
	die "Failed to apply patch on upstream master branch. git pull --rebase?"
echo 'Running `make all lint tests check-patches` ...'
make -sC "$tmp" all lint tests check-patches ||
	die "Please fix the above issues and amend your patch."