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: Wed, 12 Apr 2023 09:32:30 +0000 Message-ID: References: <835ya5m4p0.fsf@gnu.org> <83v8i4arzt.fsf@gnu.org> <838rezardu.fsf@gnu.org> <319d616d-9230-0a82-331f-0f57488e4c80@gmail.com> 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="40561"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , emacs-devel@gnu.org To: Jim Porter Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Apr 12 11:33:20 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 1pmWqu-000APo-7R for ged-emacs-devel@m.gmane-mx.org; Wed, 12 Apr 2023 11:33:20 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pmWqF-0001O2-Pv; Wed, 12 Apr 2023 05:32:39 -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 1pmWqE-0001Nl-5a for emacs-devel@gnu.org; Wed, 12 Apr 2023 05:32:38 -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 1pmWqA-0007R5-Bo for emacs-devel@gnu.org; Wed, 12 Apr 2023 05:32:37 -0400 Original-Received: (qmail 87099 invoked by uid 3782); 12 Apr 2023 11:32:31 +0200 Original-Received: from acm.muc.de (pd953ab03.dip0.t-ipconnect.de [217.83.171.3]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Wed, 12 Apr 2023 11:32:30 +0200 Original-Received: (qmail 3255 invoked by uid 1000); 12 Apr 2023 09:32:30 -0000 Content-Disposition: inline In-Reply-To: <319d616d-9230-0a82-331f-0f57488e4c80@gmail.com> 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:305264 Archived-At: Hello, Jim. On Tue, Apr 11, 2023 at 11:31:55 -0700, Jim Porter wrote: > On 4/11/2023 7:01 AM, Alan Mackenzie wrote: > > > > + /^\* [a-zA-Z0-9_.~#-]/ { > > + nfiles++ > > + if ((rc = (getline x < $2)) < 0) { > > + status = 1 > > + print "File " $2 " cannot be read: [" ERRNO "]" > > + } > > + close($2) > > + } > One thing to be careful of here (which is why I did the 'match'/'substr' > dance in my patch) is that we need to be able to handle lines like this > correctly: > * some/file.el: New file. Yes, you're right, thanks. These little things are always tripping me up. [ .... ] > Also, using 'getline' will work for checking files, but not directories. > I'm not sure this ever comes up in practice, but it might occur once in > a while if we import a large package into the Emacs tree. We could do a > bit of feature-checking and upgrade to using 'stat' if we have a newish > gawk. That way, gawk users would get proper checks for this (rare) case. > (This might not be strictly necessary.) This, too. > Finally, I think it would make sense to have this be a purely advisory > warning for now so that we could check it into the Emacs tree soon-ish. > As Eli suggests, we can try running with this hook locally, but since > I've already added some Lisp code to generate the changelog for my > workflow, I'm probably never going to trigger this myself. If this check > is just a warning, I think we could be a little more aggressive in > merging this, since it shouldn't break anyone's workflows. I think Eli's already decided the idea of checking for the existence of files isn't a good one, because of the problem of deleting and renaming files. But also, I think having the script just warn is not useful. Git purposefully makes it impossible to correct mistakes in a commit message, so we need to make sure the things are as correct as possible to begin with. -- Alan Mackenzie (Nuremberg, Germany).