Title: Pre-commit fails for git >=2.25 if repo is on a Windows subst drive · Issue #1610 · pre-commit/pre-commit · GitHub
Open Graph Title: Pre-commit fails for git >=2.25 if repo is on a Windows subst drive · Issue #1610 · pre-commit/pre-commit
X Title: Pre-commit fails for git >=2.25 if repo is on a Windows subst drive · Issue #1610 · pre-commit/pre-commit
Description: Cross reference for another issue with same apparent root cause: microsoft/vscode#100274 (comment) Issue observed with pre-commit==2.7.1 and git 2.27. Issue resolved with downgrading git to 2.21 (I only have access to certain versions on...
Open Graph Description: Cross reference for another issue with same apparent root cause: microsoft/vscode#100274 (comment) Issue observed with pre-commit==2.7.1 and git 2.27. Issue resolved with downgrading git to 2.21 (I...
X Description: Cross reference for another issue with same apparent root cause: microsoft/vscode#100274 (comment) Issue observed with pre-commit==2.7.1 and git 2.27. Issue resolved with downgrading git to 2.21 (I...
Opengraph URL: https://github.com/pre-commit/pre-commit/issues/1610
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Pre-commit fails for git \u003e=2.25 if repo is on a Windows subst drive","articleBody":"Cross reference for another issue with same apparent root cause: https://github.com/microsoft/vscode/issues/100274#issuecomment-646499795\r\n\r\nIssue observed with pre-commit==2.7.1 and git 2.27.\r\nIssue resolved with downgrading git to 2.21 (I only have access to certain versions on my work machine).\r\n\r\nSteps to recreate for pre-commit (some taken from the above cross-reference):\r\n\r\n- Install git \u003e= 2.25 on Windows\r\n\r\n- Create a subst drive (`mkdir C:\\subst_dir \u0026\u0026 subst Z: C:\\subst_dir`)\r\n\r\n- Create a git repo in there (`mkdir Z:\\repo \u0026\u0026 cd /d Z:\\repo \u0026\u0026 git init`)\r\n\r\n- Add some python code, configure pre-commit, and run pre-commit.\r\n\r\nFailure observed: `An unexpected error has occurred: ValueError: path is on mount 'Z:', start on mount 'C:'`\r\n\r\nDiagnosis - it appears that the use of `git rev-parse --show-toplevel` in `pre_commit.main.get_root()` is suffering the same issue as seen in cross-referenced ticket; git will \"see through\" the subst command and rather than return a path on the subst-defined Z: drive, it will return the path from the C: drive. With this, after `pre_commit.main._adjust_args_and_chdir()` calls `pre_commit.main.get_root()` and does a chdir to the returned location, the following call to `os.path.relpath(args.config)` then fails with the ValueError as above, because it sees the path to the config file being on `Z:` but the current location being on `C:`.\r\n\r\nAfraid I don't have a suggested resolution but wanted to flag this up. I'm not too familiar with Windows systems and I'm a long way from Admin access on my work machine so opportunities for testing are limited; this was discovered as my scratch space for repos is a subst drive.\r\n","author":{"url":"https://github.com/jcameron73","@type":"Person","name":"jcameron73"},"datePublished":"2020-09-22T16:56:17.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/1610/pre-commit/issues/1610"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:26459018-dec0-8f93-7be5-dc52cb788978 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BDD4:82BB1:CC14AD:128A429:6A562911 |
| html-safe-nonce | ae7d7183c7b82f116346ba1f1f28428c4040c8378cc4e1745b087b784665ce23 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCREQ0OjgyQkIxOkNDMTRBRDoxMjhBNDI5OjZBNTYyOTExIiwidmlzaXRvcl9pZCI6IjgyMDM1MzE0MjI4NDM0MTQ4MDEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | c55e32f4adb493513bd6b771f1af5920b3f48b0fed8f0f258e47f9ef794360ec |
| hovercard-subject-tag | issue:706545694 |
| github-keyboard-shortcuts | repository,issues,commits,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/pre-commit/pre-commit/1610/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e51907a5f6f401b27998196b0d61eb9a09fd4cb26d737ce3a1484d9493040a92/pre-commit/pre-commit/issues/1610 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e51907a5f6f401b27998196b0d61eb9a09fd4cb26d737ce3a1484d9493040a92/pre-commit/pre-commit/issues/1610 |
| og:image:alt | Cross reference for another issue with same apparent root cause: microsoft/vscode#100274 (comment) Issue observed with pre-commit==2.7.1 and git 2.27. Issue resolved with downgrading git to 2.21 (I... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jcameron73 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9d78ea552aac0685ca5f006d44f88166cbbf3bb96843f8da0c5a2c0b9908430b |
| turbo-cache-control | no-preview |
| go-import | github.com/pre-commit/pre-commit git https://github.com/pre-commit/pre-commit.git |
| octolytics-dimension-user_id | 6943086 |
| octolytics-dimension-user_login | pre-commit |
| octolytics-dimension-repository_id | 17689377 |
| octolytics-dimension-repository_nwo | pre-commit/pre-commit |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 17689377 |
| octolytics-dimension-repository_network_root_nwo | pre-commit/pre-commit |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 160a6fceec0fef718a0c3ac46f2d71ae9d5c0ff5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width