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



         




                            















                                               
                                            

                          
                                                                     
                                                                         
                          



                     
                                                                                 




                                                                           
#!/bin/sh

set -e

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

run() {
	echo "+ $*" >&2
	"$@"
}

set --
while read -r file; do
	# skip empty patches (cover letter)
	if grep -q "^diff --git " "$file"; then
		set -- "$@" "$file"
	fi
done
if [ $# -eq 0 ]; then
	exit 0
fi

echo 'Cloning upstream repo in temp dir ...'
tmp=$(mktemp -d)
trap "rm -rf -- $tmp" EXIT
run 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"

run cd $tmp

run git am -3 "$@" ||
	die "Failed to apply patch on upstream master branch. git pull --rebase?"

for target in all lint tests check-patches; do
	run make $target ||
		die "Please fix the above issues and amend your patch(es)."
done