diff options
author | Robin Jarry <robin@jarry.cc> | 2023-03-07 20:07:42 +0100 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-03-08 00:13:42 +0100 |
commit | 41942bb97df4b806520cae076387a00a7e9f39e1 (patch) | |
tree | 0740ef70eb18115dadc0ff0933b3b68830813b34 /contrib | |
parent | 335d52d8b5c861cd02984811ab2e752d3d80273d (diff) | |
download | aerc-41942bb97df4b806520cae076387a00a7e9f39e1.tar.gz |
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>
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/sendemail-validate | 34 |
1 files changed, 26 insertions, 8 deletions
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 |