From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: Mistakes in commit log messages Date: Tue, 11 Apr 2023 17:20:13 +0000 Message-ID: References: <835ya5m4p0.fsf@gnu.org> <83v8i4arzt.fsf@gnu.org> <838rezardu.fsf@gnu.org> <83edoqa2lc.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19226"; mail-complaints-to="usenet@ciao.gmane.io" Cc: jporterbugs@gmail.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Apr 11 19:21:08 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pmHg3-0004lw-Rx for ged-emacs-devel@m.gmane-mx.org; Tue, 11 Apr 2023 19:21:07 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pmHfM-0000iY-A9; Tue, 11 Apr 2023 13:20:24 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pmHfK-0000iO-D7 for emacs-devel@gnu.org; Tue, 11 Apr 2023 13:20:22 -0400 Original-Received: from mx3.muc.de ([193.149.48.5]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pmHfG-00007e-Gt for emacs-devel@gnu.org; Tue, 11 Apr 2023 13:20:21 -0400 Original-Received: (qmail 29695 invoked by uid 3782); 11 Apr 2023 19:20:15 +0200 Original-Received: from acm.muc.de (pd953a980.dip0.t-ipconnect.de [217.83.169.128]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Tue, 11 Apr 2023 19:20:14 +0200 Original-Received: (qmail 10071 invoked by uid 1000); 11 Apr 2023 17:20:13 -0000 Content-Disposition: inline In-Reply-To: <83edoqa2lc.fsf@gnu.org> X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de Received-SPF: pass client-ip=193.149.48.5; envelope-from=acm@muc.de; helo=mx3.muc.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:305241 Archived-At: 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 , emacs-devel@gnu.org > > From: Alan Mackenzie > > + /^\* [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).