From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: New Git hooks for checking file names in commit messages Date: Fri, 21 Apr 2023 18:05:05 +0300 Message-ID: <838rel46ou.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35176"; mail-complaints-to="usenet@ciao.gmane.io" Cc: jporterbugs@gmail.com, emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Apr 21 17:05:44 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 1ppsKT-0008pK-2E for ged-emacs-devel@m.gmane-mx.org; Fri, 21 Apr 2023 17:05:41 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppsJh-0002IB-Fp; Fri, 21 Apr 2023 11:04:53 -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 1ppsJe-0002Hq-OP for emacs-devel@gnu.org; Fri, 21 Apr 2023 11:04:51 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppsJd-00005d-N9; Fri, 21 Apr 2023 11:04:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=HR2E/TXsrywFoVOyOGmdUhFFLjcutS9uDm+DkPHUEfQ=; b=sYPouMIeayzI rew8S2f8IZah3ypUWVZnvd43F7dQmzFk+ZFa8BPU1qnC13ASe0gYt7qrZIDsH2MMCvnro9ChNjw2y ler0sDh/hXhgVjRdepnd9B3SJi5MYskISKHREEvSydbibuPOg1aUC98jCIU9k6QLiFtj8NtECoKx/ 10LUIvr1V3pgFHuSjUNtSvV+KcCD6tB6jF3mxTFHW4lXCExClnAwd1g3eX9JAbR9EpMDferACM81j RoXjXHN22S+A19jtvUnVrmWm2qM4LpHec/AlT0DMWAIrvIsAA5pYD//AqpqFID/IPGTOLW1ch77Xl eAOOJ9AgaqS+Exx81eogqw==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppsJd-0006Wx-0l; Fri, 21 Apr 2023 11:04:49 -0400 In-Reply-To: (message from Alan Mackenzie on Fri, 21 Apr 2023 13:57:22 +0000) 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:305547 Archived-At: > Date: Fri, 21 Apr 2023 13:57:22 +0000 > Cc: emacs-devel@gnu.org > From: Alan Mackenzie > > > There's one part that might be surprising, at least initially though: > > while this is a hook to check commit messages, it actually runs in the > > post-commit and pre-push phases. This is because we want to examine > > the full diff of the commit in order to compare against the file > > entries in the message.[1] As a result, you'll just get an advisory > > message when you make the commit (it's too late to error out), and the > > pre-push hook will prevent you from pushing a badly-formatted commit > > message upstream. > > How is this helpful? Telling somebody they've made a mistake is only > helpful if they can correct it. If "it's too late to error out", it > will just create annoyance. Immediately after such a commit it is > possible to use $ git commit --amend, but not later. And preventing > people from pushing these erroneous commits is, again, not helpful. It is still helpful, because as long as you didn't push, you can still do $ git reset HEAD^ and then fix whatever needs fixing and commit again.