Skip to content

Mapped drive on Windows error #1875

Closed

Description

@luukhopman

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:

  1. Somehow resolve that these paths are identical.
  2. Option to disable this check.

Just for information, pre-commit does not have this issue for me.

Willing to submit a PR?

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

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

Activity

  1. j178 commented on Mar 31, 2026

    @j178
    Owner

    Please share the full verbose log. That’ll help me figure out exactly what’s going on.

  2. luukhopman commented on Mar 31, 2026

    @luukhopman
    Author

    Updated the description with the -vvv logs

  3. added a commit that references this issue on Apr 1, 2026
    dd2ab40
  4. luukhopman commented on Apr 13, 2026

    @luukhopman
    Author

    Just saw the release that fixed this. Thanks a lot for the quick action!

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions