Skip to content

subject_max_length counts git's fixup! prefix, so a fixup of a subject that fits is rejected #733

Closed

Description

@hajikelu

Describe your issue

git commit --fixup <commit> is rejected with CC004 when the target's subject is within the limit, because git puts fixup! in front of it:

$ cat msg        # the target's subject, 67 characters
feat(parser): accept trailing commas in the argument list of a call
$ commit-check --message msg; echo $?
0

$ cat fixup-msg  # what `git commit --fixup` writes for it
fixup! feat(parser): accept trailing commas in the argument list of a call
$ commit-check --message fixup-msg; echo $?
✖ CC004 subject-max-length failed: fixup! feat(parser): accept trailing commas in the argument list of a call
  Subject is 74 characters; it must be at most 72 characters
1

I expected it to pass: the prefix is git's, not the author's. Could a subject that starts with fixup! , squash! or amend! be measured without that prefix, the way the (#123) suffix is already left out of the count? amend! may need more than that: the line behind it is the subject being replaced, so a reword that shortens a subject over the limit would still be rejected.

Version

commit-check 2.24.0

cchk.toml or commit-check.toml

[commit]
subject_max_length = 72

Activity

  1. added a commit that references this issue on Nov 23, 2026
    dabd45b
  2. shenxianpeng commented on Nov 23, 2026

    @shenxianpeng
    Member

    Hi @hajikelu

    Thank you for using commit-check and reporting the issue again.

    You're right: that prefix from git should not count against the limit, just like Revert "..." already doesn't.

    #734 makes skip subjects that start with git's exact fixup! , squash! or amend! prefix, so your amend! case is covered as well. It'll be in the next release very soon.

  3. added
    bug
    on Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions