aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2023-03-07 20:07:42 +0100
committerRobin Jarry <robin@jarry.cc>2023-03-08 00:13:42 +0100
commit41942bb97df4b806520cae076387a00a7e9f39e1 (patch)
tree0740ef70eb18115dadc0ff0933b3b68830813b34
parent335d52d8b5c861cd02984811ab2e752d3d80273d (diff)
downloadaerc-41942bb97df4b806520cae076387a00a7e9f39e1.tar.gz
aerc-41942bb97df4b806520cae076387a00a7e9f39e1.zip
contrib: fix sendemail validate script
The current sendemail-validate script cannot be used for patch series. It works on each patch independently from the others and make it impossible to use when there are inter dependencies. I have submitted an alternate validate script that works on whole series which is still waiting for reviews. In the meantime, propose to use my script which can work. To install it in your environment: curl -Lo ~/.local/bin/git-send-email \ https://paste.sr.ht/blob/cedcf24383022949c8dc5bc1300cf5cbc879b36f echo 'export GIT_EXEC_PATH=$PATH:$(git --exec-path)' >> ~/.profile Link: https://lore.kernel.org/git/20230103231133.64050-1-robin@jarry.cc/ Link: https://paste.sr.ht/~rjarry/7e9a98866ba2c6f34e4169debf4f2c14b574613e Signed-off-by: Robin Jarry <robin@jarry.cc>
-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