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: Mistakes in commit log messages Date: Tue, 11 Apr 2023 22:36:48 +0300 Message-ID: <83v8i28b3j.fsf@gnu.org> References: <835ya5m4p0.fsf@gnu.org> <83v8i4arzt.fsf@gnu.org> <838rezardu.fsf@gnu.org> <319d616d-9230-0a82-331f-0f57488e4c80@gmail.com> <834jpm9s1g.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37839"; mail-complaints-to="usenet@ciao.gmane.io" Cc: acm@muc.de, emacs-devel@gnu.org To: Jim Porter Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Apr 11 21:37:01 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 1pmJnY-0009dJ-EC for ged-emacs-devel@m.gmane-mx.org; Tue, 11 Apr 2023 21:37:00 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pmJmi-0004Pg-Hn; Tue, 11 Apr 2023 15:36:08 -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 1pmJmg-0004PL-Ux for emacs-devel@gnu.org; Tue, 11 Apr 2023 15:36:07 -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 1pmJmf-0008BI-Q8; Tue, 11 Apr 2023 15:36:05 -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=0m0w098jLMgcMlqetL5GJrkXv+EW+6tDHLyeilSvJUc=; b=bMpzQ7PyZm6q yGSh3qWAA25Zjev3NbnPWIAZVdZGjTZBMKxUWKScfkXHS1jAOJ08lp7xlYwfyj9z+4dfdPLzr8r9v HYHh/bVoDN8OEwUPMjQQlJS53xSI1inFCqp4Tpi10ORRmi2H/Ka2/bg2vjh7aGkblL9kvte3Q++S0 ksuiApcXsiKN+KI3b9imlwL6iINFqY80mUga5qhacj9Dk/tqTAeOxYn317cfx0hnI/3p1IO6iaSVi MaTTrflr6W9DQ2Tm7mCog1vl/SAeR2oRm8OvaL+BFsGHPCLx0a8CFRAkC2qLOeoSpXO4VCuA39Rn/ LIYO8+gz9dDKo4/2tm2zwg==; 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 1pmJmf-0005nX-3N; Tue, 11 Apr 2023 15:36:05 -0400 In-Reply-To: (message from Jim Porter on Tue, 11 Apr 2023 12:27:40 -0700) 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:305250 Archived-At: > Date: Tue, 11 Apr 2023 12:27:40 -0700 > Cc: acm@muc.de, emacs-devel@gnu.org > From: Jim Porter > > One issue with the current implementation (mentioned elsewhere in this > thread) is that it doesn't work for deleting a file from the repo. > Fixing this in the commit-msg hook is tricky. We can get the list of > changed files via "git diff --name-only" (and then we could compare our > commit message against that list), but there's a problem: I don't know > of a good way to detect when the user is amending a commit[1]. For a > normal commit, you'd get the changed files via something like "git diff > --staged --name-only", but for an amended commit, you'd want to add > "HEAD^" to that command. If this will cry wolf on every removal or rename of a file, then this cure is worse than the disease, IMNSHO. I'd prefer to waste a few hours of my time when preparing the tarball than risk annoying everyone with such false positives. > [1] The only way I've seen to do this is to look at the arguments from > the parent (Git) process that called the hook: > . > I'm not sure how reliably that works, especially on platforms like > MS-Windows... The 'ps' part won't work on Windows.