From: Eli Zaretskii <eliz@gnu.org>
To: Jim Porter <jporterbugs@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Mistakes in commit log messages
Date: Tue, 11 Apr 2023 09:02:05 +0300 [thread overview]
Message-ID: <838rezardu.fsf@gnu.org> (raw)
In-Reply-To: <CANh=_JEO4-E79dPCLc3cRLi7=ftAzc+H1FC46eck1vJN3TD3Sg@mail.gmail.com> (message from Jim Porter on Mon, 10 Apr 2023 14:52:15 -0700)
> From: Jim Porter <jporterbugs@gmail.com>
> Date: Mon, 10 Apr 2023 14:52:15 -0700
> Cc: Alan Mackenzie <acm@muc.de>, philipk@posteo.net, luangruo@yahoo.com
>
>
> On Mon, Apr 10, 2023 at 10:18 AM Jim Porter <jporterbugs@gmail.com> wrote:
> > I looked into doing this, and I think it'd be possible to extend the
> > existing commit-msg hook (in build-aux/git-hooks) to do this, at least
> > using gawk. I don't really know awk though, so I'm sure my solution
> > would be clumsy and probably gawk-specific. I wonder if we could make
> > the hooks use Emacs Lisp...
>
> If someone could figure out how to disable this code on non-gawk awks,
> I think the attached diff should do the trick. Any thoughts?
I think a solution that doesn't use Gawk-specific features would be
preferable, since no one said the mistakes are private only to users
of GNU/Linux and MS-Windows, where Gawk is basically the only Awk.
For the other readers of emacs-devel: this came from a private email I
wrote to several of our active contributors telling them that their
commit log messages included a substantial number of mistakes in file
names mentioned in the log message. The admin/authors.el program
discovered those mistakes while trying to generate attributions for
who did what in Emacs (the etc/AUTHORS file). Someone suggested to
augment our commit hooks to avoid such mistakes, at least those of
them that can be easily detected by a simple script.
The script suggested by Jim is below:
> diff --git a/build-aux/git-hooks/commit-msg b/build-aux/git-hooks/commit-msg
> index d0578bcfb46..cdc99f4b399 100755
> --- a/build-aux/git-hooks/commit-msg
> +++ b/build-aux/git-hooks/commit-msg
> @@ -45,6 +45,7 @@ at_sign=
>
> # Check the log entry.
> exec $awk -v at_sign="$at_sign" -v cent_sign="$cent_sign" -v file="$1" '
> + @load "filefuncs"
> BEGIN {
> # These regular expressions assume traditional Unix unibyte behavior.
> # They are needed for old or broken versions of awk, e.g.,
> @@ -129,6 +130,18 @@ at_sign=
> status = 1
> }
>
> + /^* / {
> + # Check that any filenames mentioned in the commit message
> + # actually exist. Currently, this only prints a warning to
> + # prevent potential issues with false positives.
> + if(match($2, "[^:/][^:]*")) {
> + FILE = substr($2, RSTART, RLENGTH)
> + if(stat(FILE, type) < 0) {
> + printf("Warning: file '\''%s'\'' in commit message not found\n", FILE)
> + }
> + }
> + }
> +
> $0 ~ unsafe_gnu_url {
> needs_rewriting = 1
> }
next parent reply other threads:[~2023-04-11 6:02 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <835ya5m4p0.fsf@gnu.org>
[not found] ` <ZDPkykCsW3i30UR9@ACM>
[not found] ` <83v8i4arzt.fsf@gnu.org>
[not found] ` <CANh=_JF0CEPDsWZSuyy9ymByma2LxcypP90O3-LQ+KhoJ8cqvg@mail.gmail.com>
[not found] ` <CANh=_JEO4-E79dPCLc3cRLi7=ftAzc+H1FC46eck1vJN3TD3Sg@mail.gmail.com>
2023-04-11 6:02 ` Eli Zaretskii [this message]
2023-04-11 14:01 ` Mistakes in commit log messages Alan Mackenzie
2023-04-11 14:57 ` Eli Zaretskii
2023-04-11 17:20 ` Alan Mackenzie
2023-04-11 18:00 ` Eli Zaretskii
2023-04-11 18:31 ` Jim Porter
2023-04-11 18:45 ` Eli Zaretskii
2023-04-11 19:27 ` Jim Porter
2023-04-11 19:36 ` Eli Zaretskii
2023-04-12 0:20 ` Jim Porter
2023-04-13 6:18 ` Jim Porter
2023-04-13 6:49 ` Eli Zaretskii
2023-04-13 7:47 ` Robert Pluim
2023-04-15 3:41 ` Jim Porter
2023-04-15 5:45 ` Jim Porter
2023-04-15 7:15 ` Eli Zaretskii
2023-04-15 10:44 ` Alan Mackenzie
2023-04-15 11:00 ` Eli Zaretskii
2023-04-21 22:16 ` Filipp Gunbin
2023-04-15 20:54 ` Jim Porter
2023-04-15 21:23 ` Jim Porter
2023-04-16 5:43 ` Eli Zaretskii
2023-04-16 20:06 ` Jim Porter
2023-04-16 20:19 ` Michael Albinus
2023-04-17 2:22 ` Eli Zaretskii
2023-04-17 7:28 ` Michael Albinus
2023-04-21 4:59 ` Jim Porter
2023-04-15 7:08 ` Eli Zaretskii
2023-04-12 9:41 ` Alan Mackenzie
2023-04-12 10:14 ` Eli Zaretskii
2023-04-12 9:32 ` Alan Mackenzie
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://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=838rezardu.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=jporterbugs@gmail.com \
/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://git.savannah.gnu.org/cgit/emacs.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).