[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Mistakes in commit log messages
From: |
Alan Mackenzie |
Subject: |
Re: Mistakes in commit log messages |
Date: |
Tue, 11 Apr 2023 17:20:13 +0000 |
Hello, Eli.
On Tue, Apr 11, 2023 at 17:57:35 +0300, Eli Zaretskii wrote:
> > Date: Tue, 11 Apr 2023 14:01:48 +0000
> > Cc: Jim Porter <jporterbugs@gmail.com>, emacs-devel@gnu.org
> > From: Alan Mackenzie <acm@muc.de>
> > + /^\* [a-zA-Z0-9_.~#-]/ {
> > + nfiles++
> > + if ((rc = (getline x < $2)) < 0) {
> > + status = 1
> > + print "File " $2 " cannot be read: [" ERRNO "]"
> The error message should explicitly mention an error in the file name
> or its leading directories, at least if ERRNO indicates the file does
> not exist. "File FOO cannot be read is too "technical" and doesn't
> explain what we are checking.
You mean something like:
print "Error in file or directory name " $2 " [" ERRNO "]"
? I'm beginning to get a bit concerned about what happens after a file
has been removed from git, or renamed. At least "cannot be read: " is
honest about what caused the error in the script. Maybe I could add
another line suggesting how to bypass the checks in commit-msg. What do
you think?
> Also, I'm not sure what is CWD when this script runs. Suppose I
> invoke "git commit" from a subdirectory of the tree root -- does this
> find files in that case?
The current working directory is always the main working directory (see
man githooks(1)) unless it's a bare commit.
> > + if (!nfiles) {
> > + print "No file lines in commit message"
> > + status = 1
> This was never an error before, so shouldn't be an error now. Log
> messages saying just
> Fix last change
> are quite common, and I don't want to disallow them.
Ah, OK. It's just I've been known to neglect the "* " at times. I'll
remove that bit, and submit a revised patch soon.
> In any case, I suggest that you (and maybe others) try running with
> this for some time, to make sure there are no regressions.
Will do.
> Thanks.
> P.S. Is 'getline' available in non-GNU Awk's?
The gawk manual implies strongly it is available in POSIX AWKs. It
might even explicitly say so somewhere. So I strongly suspect the
answer to your question is yes, but perhaps not in every AWK.
--
Alan Mackenzie (Nuremberg, Germany).
- Re: Mistakes in commit log messages, Eli Zaretskii, 2023/04/11
- Re: Mistakes in commit log messages, Alan Mackenzie, 2023/04/11
- Re: Mistakes in commit log messages, Eli Zaretskii, 2023/04/11
- Re: Mistakes in commit log messages, Jim Porter, 2023/04/11
- Re: Mistakes in commit log messages, Eli Zaretskii, 2023/04/11
- Re: Mistakes in commit log messages, Jim Porter, 2023/04/11
- Re: Mistakes in commit log messages, Eli Zaretskii, 2023/04/11
- Re: Mistakes in commit log messages, Jim Porter, 2023/04/11
- Re: Mistakes in commit log messages, Jim Porter, 2023/04/13
- Re: Mistakes in commit log messages, Eli Zaretskii, 2023/04/13
- Re: Mistakes in commit log messages, Robert Pluim, 2023/04/13
- Re: Mistakes in commit log messages, Jim Porter, 2023/04/14