Skip to content

--show-diff-on-failure does not respect --color #1007

@chadrik

Description

@chadrik

I'm running pre-commit on gitlab, and I noticed that the diffs produced when --show-diff-on-failure is enabled do not respect --color=always.

It looks like a pretty easy fix: we just need to pass the --color setting to git diff. It supports the same "auto", "always", "never" settings as pre-commit.

git diff --color documentation.

code in question: https://github.com/pre-commit/pre-commit/blob/master/pre_commit/commands/run.py#L227

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions