Skip to content

prek shouldn't trigger on pre-commit.legacy hooks #1621

@thomasaarholt

Description

@thomasaarholt

Summary

Hiya! Thanks for making great software!

I was confused today, since I've been playing around with pre-commit and prek, and suddenly both were running, despite me having just run prek uninstall.

Turns out, I must have done this order of operations:

pre-commit install # formerly

# here comes the prek install
pre-commit uninstall
prek install

# then the "oopsie" set of commands
pre-commit install

(The last command moved the prek pre-commit hook to pre-commit.legacy, I have since understood)

Continuing with my regular git flow, I now triggered both pre-commit and prek. "Oops, I must have done something wrong, let me uninstall prek":

❯ prek uninstall                                                                                                                                                               (notesUtilityMetrics-3.12-2026-02-09)
`.git/hooks/pre-commit` is not managed by prek, skipping.

"What?" And I still had the same behaviour!

(Cue a bit of digging, and I now understand the issue)

I suggest that either or both:

  • prek shouldn't trigger if called from a pre-commit.legacy file (this might not be in your control)
  • prek uninstall should remove any pre-commit.legacy files containing references to prek

Willing to submit a PR?

  • Yes — I’m willing to open a PR to fix this.

Platform

macOS 26.2

Version

prek 0.3.2 (71790f3 2026-02-06)

.pre-commit-config.yaml

Not relevant

Log file

2026-02-10T08:53:29.190238Z DEBUG prek: 0.3.2 (71790f3 2026-02-06)
2026-02-10T08:53:29.190371Z DEBUG Args: ["prek", "uninstall"]
2026-02-10T08:53:29.205887Z TRACE get_root: close time.busy=15.3ms time.idle=4.79µs
2026-02-10T08:53:29.205946Z DEBUG Git root: /Users/thomas/repos/fastml
2026-02-10T08:53:29.205978Z DEBUG Found workspace root at /Users/thomas/repos/fastml
2026-02-10T08:53:29.205990Z DEBUG Found project root at ``
2026-02-10T08:53:29.206005Z DEBUG Loading project configuration path=.pre-commit-config.yaml
2026-02-10T08:53:29.207740Z TRACE Executing /opt/homebrew/bin/git rev-parse --git-common-dir

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