unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: Tomi Ollila <tomi.ollila@iki.fi>,
	David Bremner <david@tethera.net>,
	notmuch@notmuchmail.org
Subject: [PATCH v2] devel: script for checking a commit (series)
Date: Sun, 10 Oct 2021 08:54:50 -0300	[thread overview]
Message-ID: <20211010115449.1238093-1-david@tethera.net> (raw)
In-Reply-To: <m28s1wbxg8.fsf@guru.guru-group.fi>

'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

  reply	other threads:[~2021-10-10 11:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-28 14:08 [PATCH] devel: two scripts for checking proposed changes David Bremner
2021-06-28 14:19 ` Tomi Ollila
2021-06-29 11:27   ` David Bremner
2021-07-23 20:13     ` Tomi Ollila
2021-10-10 11:54       ` David Bremner [this message]
2021-10-10 19:02         ` [PATCH v2] devel: script for checking a commit (series) Tomi Ollila
2021-10-10 23:57           ` David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211010115449.1238093-1-david@tethera.net \
    --to=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    --cc=tomi.ollila@iki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).