Skip to content

CT1 Title does not start with one of […], reapply, […]: "Reapply "fix: Don't install mcomix"" is self-contradictory #554

@l0b0

Description

@l0b0

When reverting an already reverted commit using Git 2.45.2 it creates a commit with a title of Reapply "[original commit message]". I believe this used to generate messages like revert: revert: "[original commit message]" in older versions. I've added "reapply" to the list of contrib-title-conventional-commits types, and "reapply" is printed in the error message, but it is not applied in the same way as "revert":

❯ gitlint --debug
DEBUG: gitlint.cli To report issues, please visit https://github.com/jorisroovers/gitlint/issues
DEBUG: gitlint.cli Platform: Linux-6.6.51-x86_64-with-glibc2.39
DEBUG: gitlint.cli Python version: 3.12.4 (main, Jun  6 2024, 18:26:44) [GCC 13.3.0]
DEBUG: gitlint.git ('--version',)
DEBUG: gitlint.cli Git version: git version 2.45.2
DEBUG: gitlint.cli Gitlint version: 0.19.1
DEBUG: gitlint.cli GITLINT_USE_SH_LIB: [NOT SET]
DEBUG: gitlint.cli TERMINAL_ENCODING: UTF-8
DEBUG: gitlint.cli FILE_ENCODING: UTF-8
DEBUG: gitlint.cli Configuration
config-path: /home/victor/my projects/root/.gitlint
[GENERAL]
extra-path: None
contrib: ['contrib-title-conventional-commits']
ignore: body-is-missing
ignore-merge-commits: True
ignore-fixup-commits: True
ignore-fixup-amend-commits: True
ignore-squash-commits: True
ignore-revert-commits: True
ignore-stdin: False
staged: False
fail-without-commits: False
regex-style-search: False
verbosity: 3
debug: True
target: /home/victor/my projects/root
[RULES]
  I1: ignore-by-title
     ignore=all
     regex=None
  I2: ignore-by-body
     ignore=all
     regex=None
  I3: ignore-body-lines
     regex=None
  I4: ignore-by-author-name
     ignore=all
     regex=None
  T1: title-max-length
     line-length=72
  T2: title-trailing-whitespace
  T6: title-leading-whitespace
  T3: title-trailing-punctuation
  T4: title-hard-tab
  T5: title-must-not-contain-word
     words=WIP
  T7: title-match-regex
     regex=None
  T8: title-min-length
     min-length=5
  B1: body-max-line-length
     line-length=80
  B5: body-min-length
     min-length=20
  B6: body-is-missing
     ignore-merge-commits=True
  B2: body-trailing-whitespace
  B3: body-hard-tab
  B4: body-first-line-empty
  B7: body-changed-file-mention
     files=
  B8: body-match-regex
     regex=None
  M1: author-valid-email
     regex=^[^@ ]+@[^@ ]+\.[^@ ]+
  CT1: contrib-title-conventional-commits
     types=build,chore,ci,docs,feat,fix,perf,reapply,refactor,revert,style,test

DEBUG: gitlint.cli No --msg-filename flag, no or empty data passed to stdin. Using the local repo.
DEBUG: gitlint.git ('log', '-1', '--pretty=%H')
DEBUG: gitlint.cli Linting 1 commit(s)
DEBUG: gitlint.git ('log', '9c67f55ca6e3c758fb139dd9b3759ba5606286a3', '-1', '--pretty=%aN%x00%aE%x00%ai%x00%P%n%B')
DEBUG: gitlint.git ('config', '--get', 'core.commentchar')
DEBUG: gitlint.lint Linting commit 9c67f55ca6e3c758fb139dd9b3759ba5606286a3
DEBUG: gitlint.git ('diff-tree', '--no-commit-id', '--numstat', '-r', '--root', '9c67f55ca6e3c758fb139dd9b3759ba5606286a3')
DEBUG: gitlint.git ('branch', '--contains', '9c67f55ca6e3c758fb139dd9b3759ba5606286a3')
DEBUG: gitlint.lint Commit Object
--- Commit Message ----
Reapply "fix: Don't install mcomix"

Still broken.

This reverts commit 1c31c4f1a1df0e8ff920fdb7d2ba1621b9f72fac.

--- Meta info ---------
Author: Victor Engmark <victor@engmark.name>
Date:   2024-09-17 14:43:56 +1200
is-merge-commit:  False
is-fixup-commit:  False
is-fixup-amend-commit: False
is-squash-commit: False
is-revert-commit: False
Parents: ['c47e73094d082bb730e50bc39b0260f28cf26842']
Branches: ['do-not-install-mcomix']
Changed Files: ['modules/gui.nix']
Changed Files Stats:
  modules/gui.nix: 1 additions, 1 deletions
-----------------------
1: CT1 Title does not start with one of build, chore, ci, docs, feat, fix, perf, reapply, refactor, revert, style, test: "Reapply "fix: Don't install mcomix""
DEBUG: gitlint.cli Exit Code = 1

Workarounds:

  • If I change the commit message to start with "reapply:" (lowercase; note the colon) it passes inspection.
  • Removing the Reapply " prefix and " suffix also works.

I assume there's a special case in the code for handling Revert "[message]", which should also be applied to Reapply "[message]".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions