Make is_revert stricter, to match GCCs changelog scripts#23
Conversation
|
|
af7e843 to
d868361
Compare
Reverts like https://gcc.gnu.org/cgit/gcc/commit/?id=eec8da328cf1f91db302ab4cee803e269e68ad33 are let through by the hooks, but then lead to failures in the changelog generating script: https://inbox.sourceware.org/gccadmin/20260415001632.71DF64BA23C4@sourceware.org/ This check should prevent that.
d868361 to
f3a4440
Compare
|
Hello @ArsenArsen , First of all, thank you for taking the time to propose a fix! And great bonus points for providing a testcase as well. I went through the commit message, then followed the links to try to understand what concretely was the problem, and also looked at the commit. IIUC, the problem is that the title of the revert got split into two lines, thus making the second line not an empty line? That's what the error message seems to be saying, but the comments in your change seems to be saying different (actually, I don't understand the comment in the new function Before going further with this, and looking at my current understanding of your patch, I think this is the situation where we need properly and clearly document the extent of the problem we are trying to solve, and have a discussion about how we plan on addressing the need together with a rationale of why we select one option vs the other options. What this tells me is that we need a proper issue for this. In the issue description, I would like to avoid external links and instead provide the necessary information in place: The commit message, how that commit-message was generated (whether 100% automatically, or edited manually), and a description of the problem that this commit message caused later on that doesn't require the analysis of a program's output. With that said, if I go by the contents of the patch rather than the script error, I think you want to catch cases where people alter a specific line in revert commits, as otherwise this affects one of GCC's production scripts. If my understanding is correct, I would argue that your need is quite specific to your project, and perhaps the right solution is to implement this check using the |
|
Hi Joel,
The messages printed are a red herring; the codepath that generated those warnings shouldn't have been taken because the commit should've been detected as a revert. The log is generated by a script not in Said script relies on the hooks validating all commits that get pushed. So, the actual issue is that the commit wasn't blocked on push by the hooks. This happened because the commit is a revert. Of course, the scripts know what a reversion is also, but they are much more strict than Taking a step back, when (picked at random, just what I happened to have cloned locally) ... however, some people alter the However, git-hooks consider any commit with Ergo, the assumption that hooks prevent any invalid commits from reaching the repo is broken. The intention is to make this exemption case stricter (by making it match
I think the The new That could be moved into the GCC-specific bits if so desired, but I figured it'd be more broadly useful. If I'm wrong about I hope that clarifies it. WRT the comments and docstrings, if we decide to do this change upstream, I'll reword them in a way that relies on GCC context less - sorry about that, I'm not 100% clear on where these hooks end and GCC-specific bits start, so it seems that I guessed wrong. |
|
Thanks for the clarifications @ArsenArsen . And also for pointing out that all checks for revert commits are disabled. The documentation is not completely clear about whether this also disables the We can discuss possible ways forward, but for that let's create an issue so that everything is properly tracked for posterity. On the other hand, for GCC's issue at hand, I'm wondering why it's such a bad thing that people add extra information in the commit message, especially when that extra information doesn't take away information generated by |
|
I'll write up a summary in an issue tomorrow. On:
That's fine, and good, of course, as long as the commit contains the unaltered "This reverts commit" line (see https://gcc.gnu.org/cgit/gcc/commit/?id=e1f2d0d3e6018510a002ad8b3c0dfeb2ac7ec5ca for an example; notice the quite complete description followed by the Git-generated "This reverts commit" line). |
Reverts like
https://gcc.gnu.org/cgit/gcc/commit/?id=eec8da328cf1f91db302ab4cee803e269e68ad33 are let through by the hooks, but then lead to failures in the changelog generating script:
https://inbox.sourceware.org/gccadmin/20260415001632.71DF64BA23C4@sourceware.org/
This check should prevent that.