unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Jim Porter <jporterbugs@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: bjorn.bidar@thaodan.de, arsen@aarsen.me, acm@muc.de, emacs-devel@gnu.org
Subject: Re: New Git hooks for checking file names in commit messages
Date: Sun, 23 Apr 2023 12:15:37 -0700	[thread overview]
Message-ID: <bd8673ce-eb42-520b-7351-d474dce1f696@gmail.com> (raw)
In-Reply-To: <83pm7vyrp4.fsf@gnu.org>

I've pushed a couple of fixes for the hooks (described in more detail 
below). I *think* this should resolve all the issues, though I'll still 
do more testing locally, especially with merge commits.

More generally, if people find these hooks to be annoying or unhelpful, 
I truly won't be offended if they get backed out. I wrote them in the 
hopes that it will make it easier to maintain Emacs, but if they can't 
meet that goal, then they shouldn't stick around causing problems.

On 4/23/2023 12:37 AM, Eli Zaretskii wrote:
>> Date: Sun, 23 Apr 2023 00:07:49 -0700
>> Cc: bjorn.bidar@thaodan.de, arsen@aarsen.me, acm@muc.de, emacs-devel@gnu.org
>> From: Jim Porter <jporterbugs@gmail.com>
>>
>> Ok, it should be easy to restrict the pre-push hook to master/emacs-NN
>> branches. ...
> 
> It's a compromise (ideally, other mistakes in file names should also
> be detected), but I think it's the best we can do without too many
> false positives.

Ok, done.

>> This part should be easy enough to handle: if a commit is a merge
>> commit, we just won't validate any file names listed in the log message.
> 
> This is not what I meant, though.  If a merge-commit does have a
> meaningful log message, its file names should be validated.

It turns out this is actually very easy to do, now that I've learned 
about the "--first-parent" option in Git. Using that on a merge commit, 
I can get a list of all the changes that were merged into the target 
branch (i.e. everything from the feature branch that's now on, say, master).

With this fix, commit 289b457cac1 (the merge of 'abort-redisplay') now 
passes the tests, as it should.

>> Suppose I make commits A, B, and C on a branch, and then merge to master
>> with merge-commit D. Does your message mean that the only commit that
>> ends up in the ChangeLog file is commit D? (Or that commit D is the only
>> one that authors.el looks at?)
> 
> The only one that it is reasonable to validate is commit D, yes.  The
> other commits should not be rejected due to their log messages, at
> least not ideally.

I believe "--first-parent" also solves this case. In particular, by 
using this option, the hook correctly ignores the commits from the Eglot 
branch that were merged in. This means that any merge like that in the 
future won't run afoul of these hooks.

I'll have to do a bit more testing here to try out other edge cases, but 
this should only result in false negatives, not false positives. (False 
negatives would just require some fixup when making the tarball.)



  reply	other threads:[~2023-04-23 19:15 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-21  4:55 New Git hooks for checking file names in commit messages Jim Porter
2023-04-21 12:05 ` John Yates
2023-04-21 16:44   ` Jim Porter
2023-04-21 17:44     ` Jim Porter
2023-04-22  6:11       ` Eli Zaretskii
2023-04-22  6:59         ` Jim Porter
2023-04-22  7:51           ` Eli Zaretskii
2023-04-22 19:44             ` Jim Porter
2023-04-22 23:21               ` John Yates
2023-04-21 13:57 ` Alan Mackenzie
2023-04-21 15:05   ` Eli Zaretskii
2023-04-21 15:38     ` Arsen Arsenović
2023-04-21 15:50       ` Eli Zaretskii
2023-04-21 16:20         ` Arsen Arsenović
2023-04-21 17:44           ` Eli Zaretskii
2023-04-21 17:50             ` Arsen Arsenović
2023-04-22  6:16               ` Eli Zaretskii
2023-04-21 18:25             ` Andreas Schwab
2023-04-21 19:03         ` Björn Bidar
2023-04-21 19:53           ` Jim Porter
2023-04-22  7:03           ` Eli Zaretskii
2023-04-22 19:52             ` Jim Porter
2023-04-23  6:11               ` Eli Zaretskii
2023-04-23  7:07                 ` Jim Porter
2023-04-23  7:37                   ` Eli Zaretskii
2023-04-23 19:15                     ` Jim Porter [this message]
2023-04-23 19:24                       ` Eli Zaretskii
2023-04-23  7:19                 ` Jim Porter
2023-04-23  7:39                   ` Eli Zaretskii
2023-04-23  9:51                     ` Björn Bidar
2023-04-22 23:55     ` Dmitry Gutov
2023-04-23  5:36       ` Eli Zaretskii
2023-04-23  9:47       ` Björn Bidar
2023-04-21 16:39   ` Jim Porter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bd8673ce-eb42-520b-7351-d474dce1f696@gmail.com \
    --to=jporterbugs@gmail.com \
    --cc=acm@muc.de \
    --cc=arsen@aarsen.me \
    --cc=bjorn.bidar@thaodan.de \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).