[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.
- Re: Mistakes in commit log messages, Eli Zaretskii, 2023/04/11
- Re: Mistakes in commit log messages, Alan Mackenzie, 2023/04/11
- Re: Mistakes in commit log messages, Jim Porter, 2023/04/11
- Re: Mistakes in commit log messages, Eli Zaretskii, 2023/04/11
- Re: Mistakes in commit log messages, Jim Porter, 2023/04/11
- Re: Mistakes in commit log messages,
Eli Zaretskii <=
- Re: Mistakes in commit log messages, Jim Porter, 2023/04/11
- Re: Mistakes in commit log messages, Jim Porter, 2023/04/13
- Re: Mistakes in commit log messages, Eli Zaretskii, 2023/04/13
- Re: Mistakes in commit log messages, Robert Pluim, 2023/04/13
- Re: Mistakes in commit log messages, Jim Porter, 2023/04/14
- Re: Mistakes in commit log messages, Jim Porter, 2023/04/15
- Re: Mistakes in commit log messages, Eli Zaretskii, 2023/04/15
- Re: Mistakes in commit log messages, Alan Mackenzie, 2023/04/15
- Re: Mistakes in commit log messages, Eli Zaretskii, 2023/04/15
- Re: Mistakes in commit log messages, Filipp Gunbin, 2023/04/21