Skip to content

mixed-line-ending fails on Windows when operating on COMMIT_EDITMSG (--fix=lf) #1267

Description

@arulrajnet

Summary

When committing on a Windows environment with mixed-line-ending configured with --fix=lf, the hook runs against COMMIT_EDITMSG, fixes the CRLF line endings to LF, and exits with code 1, aborting the commit.

Image

Environment

  • OS: Windows
  • pre-commit version: 3.8.0
  • pre-commit-hooks version: v6.0.0
  • Git version: 2.50.1

Configuration (.pre-commit-config.yaml)

repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v6.0.0
    hooks:
      - id: trailing-whitespace
        args: [--markdown-linebreak-ext=md]
      - id: end-of-file-fixer
      - id: mixed-line-ending
        args: [--fix=lf]
      - id: check-merge-conflict
      - id: check-added-large-files
        args: [--maxkb=500]
      - id: check-yaml
        args: [--unsafe]
      - id: forbid-submodules
      - id: check-executables-have-shebangs
      - id: check-shebang-scripts-are-executable

Expected Behavior

mixed-line-ending should either ignore COMMIT_EDITMSG by default or handle system-generated commit message files without failing the commit step on Windows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions