[PATCH v2] devel: script for checking a commit (series)

Subject: [PATCH v2] devel: script for checking a commit (series)

Date: Sun, 10 Oct 2021 08:54:50 -0300

To: Tomi Ollila, David Bremner, notmuch@notmuchmail.org

Cc:

From: David Bremner


'check-notmuch-commit' is an updated version of a script I have been
using (although not always as consistently as I should) before sending
patches to the list.

Although it requires a bit more tooling, encouraging people to use
check-notmuch-commit might reduce the number of round trips to the
list for style nitpicks.
---
 devel/check-notmuch-commit | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100755 devel/check-notmuch-commit

Changes since last round:

~ '--quick' argument to avoid expensive build/test
~ use Tomi's trick to avoid multiple calls to dirname
~ merge reindent-lisp into the main script. This eases development
  (only one script to put in path) and reduces execs.
~ include quoting fix for call to emacs  
~ add diff-filter option

diff --git a/devel/check-notmuch-commit b/devel/check-notmuch-commit
new file mode 100755
index 00000000..99ed229d
--- /dev/null
+++ b/devel/check-notmuch-commit
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+# Usage suggestion:
+#   git rebase -i --exec devel/check-notmuch-commit origin/master
+
+set -e
+
+quick=0
+case "$1" in
+    -q|-Q|--quick)
+        quick=1
+        ;;
+esac
+
+if [ $quick = 0 ]; then
+    make test
+fi
+
+unset uconf
+for file in $(git diff --name-only --diff-filter=AM HEAD^); do
+    case $file in
+	*.c|*.h|*.cc|*.hh)
+            uncrustify --replace -c "${uconf=$(dirname "$0")/uncrustify.cfg}" "$file"
+	    ;;
+	*.el)
+	    emacs -Q --batch "$file" --eval '(indent-region (point-min) (point-max) nil)' -f save-buffer
+	    ;;
+    esac
+done
+
+git diff --quiet
+
-- 
2.33.0
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: