unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Tomi Ollila <tomi.ollila@iki.fi>
To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org
Subject: Re: [PATCH] devel: two scripts for checking proposed changes
Date: Fri, 23 Jul 2021 23:13:27 +0300	[thread overview]
Message-ID: <m28s1wbxg8.fsf@guru.guru-group.fi> (raw)
In-Reply-To: <874kdgc3m8.fsf@tethera.net>

On Tue, Jun 29 2021, David Bremner wrote:

> Tomi Ollila <tomi.ollila@iki.fi> writes:
>
>>> +
>>> +set -e
>>> +make test
>>
>> This may fail miserably (or is painfully slow (doing configure and make...)
>>
>
> At least for my use case, running the tests for each commit is the main
> point. The formatting stuff is nice to have, but only if the tests run.
> I could invoke the notmuch-test script directly, but that is
> arguably slightly less robust because of the need to create test-binaries.
>
>>> +for file in $(git diff --name-only HEAD^); do
>>
>> is this also mentioning deleted files... ? (--diff-filter=AM) ?
>
> Oh, good point.
>
>>
>>> +    case $file in
>>> +	*.c|*.h|*.cc|*.hh)
>>> +            uncrustify --replace -c $(dirname "$0")/uncrustify.cfg "$file"
>>
>> dirname "$0" could be resolved once before loop.
>>
>
> yes, although I'm not sure it's a win?

actually (IMO) the 'winnest' option is to:

first have

    unset dn0

and then in all cases of $(dirname "$0") to be replaced with

    "${dn0=$(dirname "$0")}"

In this case $(dirname "$0") is executed at most once -- but zero times
in case the result is never used. (note also quotes around the whole
expression :)

Tomi

>
>>> +	    ;;
>>> +	*.el)
>>> +            $(dirname "$0")/reindent-elisp "$file"
>>> +	    ;;
>>> +    esac
>>> +done
>>> +
>>> +git diff --quiet
>>> +
>>> diff --git a/devel/reindent-elisp b/devel/reindent-elisp
>>> new file mode 100755
>>> index 00000000..f6ce3844
>>> --- /dev/null
>>> +++ b/devel/reindent-elisp
>>> @@ -0,0 +1,8 @@
>>> +#!/bin/sh
>>> +
>>> +if [ $# -lt 1 ]; then
>>
>> if [ $# -ne 1 ] ... (see at the end)
>>
> OK
>>> +    printf "usage: $0 <path.el>\n"
>>
>> Angle brackets are bad in example -- if copy-pasted to terminal (and badly
>> edited) does redirections...
>
> ack
>
>>
>>> +    exit 1
>>> +fi
>>> +
>>> +emacs -Q --batch $1 --eval '(indent-region (point-min) (point-max) nil)'
>>> -f save-buffer
>>
>> ... as here is $1 -- which should be quoted as "$1"
>
> OK
>
>>
>>> -- 
>>> 2.30.2
> _______________________________________________
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-leave@notmuchmail.org

  reply	other threads:[~2021-07-23 20:13 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 [this message]
2021-10-10 11:54       ` [PATCH v2] devel: script for checking a commit (series) David Bremner
2021-10-10 19:02         ` 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=m28s1wbxg8.fsf@guru.guru-group.fi \
    --to=tomi.ollila@iki.fi \
    --cc=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    /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).