aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTING.md2
-rw-r--r--Makefile3
-rwxr-xr-xcontrib/sendemail-validate34
3 files changed, 29 insertions, 10 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index dc8f17cb..8bd543fd 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -69,7 +69,7 @@ defaults:
git config format.subjectPrefix "PATCH aerc"
git config sendemail.to "~rjarry/aerc-devel@lists.sr.ht"
git config sendemail.validate true
- ln -sf ../../contrib/sendemail-validate .git/hooks/sendemail-validate
+ ln -sf ../../contrib/sendemail-validate-series .git/hooks/sendemail-validate
And send the patch to the mailing list ([step by step
instructions][git-send-email-tutorial]):
diff --git a/Makefile b/Makefile
index 44bfcffe..1874e0ff 100644
--- a/Makefile
+++ b/Makefile
@@ -196,7 +196,8 @@ gitconfig:
git config sendemail.to "~rjarry/aerc-devel@lists.sr.ht"
git config sendemail.validate true
@mkdir -p .git/hooks
- ln -sf ../../contrib/sendemail-validate .git/hooks/sendemail-validate
+ @rm -f .git/hooks/sendemail-validate
+ ln -sf ../../contrib/sendemail-validate .git/hooks/sendemail-validate-series
.PHONY: check-patches
check-patches:
diff --git a/contrib/sendemail-validate b/contrib/sendemail-validate
index f334bff5..d94f6c3e 100755
--- a/contrib/sendemail-validate
+++ b/contrib/sendemail-validate
@@ -7,17 +7,35 @@ die() {
exit 1
}
-email="${1?email file}"
-# skip empty patches (cover letter)
-grep -q "^diff --git " "$email" || exit 0
+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
-git clone -q --depth=1 "https://git.sr.ht/~rjarry/aerc" "$tmp" ||
+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"
-git -C "$tmp" am -3 "$email" ||
+
+run cd $tmp
+
+run git am -3 "$@" ||
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."
+
+for target in all lint tests check-patches; do
+ run make $target ||
+ die "Please fix the above issues and amend your patch(es)."
+done