aboutsummaryrefslogtreecommitdiff
path: root/devel/check-notmuch-commit
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2021-10-10 08:47:58 -0300
committerDavid Bremner <david@tethera.net>2021-10-10 20:55:09 -0300
commita4b1c3933137ca71793f185a82c44442233c2b46 (patch)
treede68bb00d9b2ab9c45683ee6b19045a9e8c2d8fd /devel/check-notmuch-commit
parent6e050de4c01107ad0d914170aacf261701d2b71c (diff)
devel: script for checking a commit (series)
'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.
Diffstat (limited to 'devel/check-notmuch-commit')
-rwxr-xr-xdevel/check-notmuch-commit31
1 files changed, 31 insertions, 0 deletions
diff --git a/devel/check-notmuch-commit b/devel/check-notmuch-commit
new file mode 100755
index 00000000..eca5fb96
--- /dev/null
+++ b/devel/check-notmuch-commit
@@ -0,0 +1,31 @@
+#!/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