Summary
prek run results in the following error in my system:
Workspace root `D:\<...>` is not under git root `C:/D-Data/<...>`
D:/ on my system is a mapped drive, it does not physically exists. On one hand it makes sense that there is an error here, but perhaps it is too strict given that these two paths ultimately represents the same location on my system. With the --cd option set to override the path it works. However, maybe there are a few options that can be considered:
- Somehow resolve that these paths are identical.
- Option to disable this check.
Just for information, pre-commit does not have this issue for me.
Willing to submit a PR?
Platform
Windows 11
Version
prek 0.3.8 (bb412c0 2026-03-23)
.pre-commit-config.yaml
Log file
2026-03-31T14:14:05.374371Z DEBUG prek: 0.3.8 (bb412c080 2026-03-23)
2026-03-31T14:14:05.375006Z DEBUG Args: ["prek", "-vvv", "run"]
2026-03-31T14:14:05.478803Z TRACE get_root: close time.busy=103ms time.idle=5.40µs
2026-03-31T14:14:05.479932Z DEBUG Git root: C:/D-Data/<redacted>/<redacted>
2026-03-31T14:14:05.480114Z TRACE Executing `C:\Program Files\Git\cmd\git.exe ls-files --unmerged`
2026-03-31T14:14:05.578428Z DEBUG Found workspace root at `D:\<redacted>\<redacted>`
2026-03-31T14:14:05.579128Z TRACE Include selectors: ``
2026-03-31T14:14:05.579271Z TRACE Skip selectors: ``
2026-03-31T14:14:05.579905Z DEBUG discover{root="D:\\<redacted>\\<redacted>" config=None refresh=false}: Loaded workspace from cache
2026-03-31T14:14:05.580296Z DEBUG discover{root="D:\\<redacted>\\<redacted>" config=None refresh=false}: Loading project configuration path=.pre-commit-config.yaml
2026-03-31T14:14:05.581172Z TRACE discover{root="D:\\<redacted>\\<redacted>" config=None refresh=false}: close time.busy=1.73ms time.idle=1.90µs
2026-03-31T14:14:05.581614Z TRACE Executing `C:\Program Files\Git\cmd\git.exe diff --exit-code --name-only -z D:\<redacted>\<redacted>\.pre-commit-config.yaml`
2026-03-31T14:14:05.676535Z TRACE Checking lock resource="store" path=C:\Users\hopmanl\AppData\Local\prek\.lock
2026-03-31T14:14:05.677158Z DEBUG Acquired lock resource="store"
2026-03-31T14:14:05.679591Z DEBUG Hooks going to run: ["trailing-whitespace", "check-added-large-files", "check-case-conflict", "end-of-file-fixer", "fix-byte-order-marker", "check-json", "check-toml", "check-yaml", "mixed-line-ending", "check-merge-conflict", "detect-private-key", "ruff-check", "ruff-format", "ty-check"]
2026-03-31T14:14:05.680620Z DEBUG Hook `trailing-whitespace` is a meta or builtin hook, no installation needed
2026-03-31T14:14:05.680882Z DEBUG Hook `check-added-large-files` is a meta or builtin hook, no installation needed
2026-03-31T14:14:05.681081Z DEBUG Hook `check-case-conflict` is a meta or builtin hook, no installation needed
2026-03-31T14:14:05.681256Z DEBUG Hook `end-of-file-fixer` is a meta or builtin hook, no installation needed
2026-03-31T14:14:05.681409Z DEBUG Hook `fix-byte-order-marker` is a meta or builtin hook, no installation needed
2026-03-31T14:14:05.681591Z DEBUG Hook `check-json` is a meta or builtin hook, no installation needed
2026-03-31T14:14:05.681778Z DEBUG Hook `check-toml` is a meta or builtin hook, no installation needed
2026-03-31T14:14:05.681951Z DEBUG Hook `check-yaml` is a meta or builtin hook, no installation needed
2026-03-31T14:14:05.682216Z DEBUG Hook `mixed-line-ending` is a meta or builtin hook, no installation needed
2026-03-31T14:14:05.682744Z DEBUG Hook `check-merge-conflict` is a meta or builtin hook, no installation needed
2026-03-31T14:14:05.683018Z DEBUG Hook `detect-private-key` is a meta or builtin hook, no installation needed
2026-03-31T14:14:05.683190Z DEBUG Hook `ruff-check` does not need installation
2026-03-31T14:14:05.683343Z DEBUG Hook `ruff-format` does not need installation
2026-03-31T14:14:05.683500Z DEBUG Hook `ty-check` does not need installation
2026-03-31T14:14:05.683678Z TRACE Released lock path=C:\Users\hopmanl\AppData\Local\prek\.lock
2026-03-31T14:14:05.683914Z TRACE Executing `C:\Program Files\Git\cmd\git.exe diff --diff-filter=A --name-only -z -- D:\<redacted>\<redacted>`
2026-03-31T14:14:05.783417Z TRACE Executing `C:\Program Files\Git\cmd\git.exe write-tree`
2026-03-31T14:14:05.887253Z TRACE Executing `C:\Program Files\Git\cmd\git.exe diff-index --binary --exit-code d862e964c6cb62d24199b5e70404e2738bb4699e -- D:\<redacted>\<redacted>`
2026-03-31T14:14:05.999303Z DEBUG Working tree is clean
2026-03-31T14:14:05.999790Z TRACE collect_files: close time.busy=24.7µs time.idle=2.30µs
error: Failed to collect files
caused by: Workspace root `D:\<redacted>\<redacted>` is not under git root `C:/D-Data/<redacted>/<redacted>`
caused by: prefix not found
Summary
prek runresults in the following error in my system:D:/on my system is a mapped drive, it does not physically exists. On one hand it makes sense that there is an error here, but perhaps it is too strict given that these two paths ultimately represents the same location on my system. With the --cd option set to override the path it works. However, maybe there are a few options that can be considered:Just for information,
pre-commitdoes not have this issue for me.Willing to submit a PR?
Platform
Windows 11
Version
prek 0.3.8 (bb412c0 2026-03-23)
.pre-commit-config.yaml
Log file