emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mistakes in commit log messages


From: Eli Zaretskii
Subject: Re: Mistakes in commit log messages
Date: Tue, 11 Apr 2023 22:36:48 +0300

> Date: Tue, 11 Apr 2023 12:27:40 -0700
> Cc: acm@muc.de, emacs-devel@gnu.org
> From: Jim Porter <jporterbugs@gmail.com>
> 
> 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: 
> <https://stackoverflow.com/questions/19387073/how-to-detect-commit-amend-by-pre-commit-hook>.
>  
> I'm not sure how reliably that works, especially on platforms like 
> MS-Windows...

The 'ps' part won't work on Windows.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]