[PR #608] fix: Fork on Windows store forward-slash path (fixes #606) #605

Closed
opened 2026-03-02 04:14:05 +03:00 by kerem · 0 comments
Owner

Original Pull Request: https://github.com/git-ai-project/git-ai/pull/608

State: closed
Merged: Yes


fix: Fork on Windows store forward-slash path (fixes #606)

Summary

Fixes #606 by updating the Fork Windows installer integration to store and compare a valid Windows path with forward slashes (e.g. C:/Users/.../git.exe) for CustomGitInstancePath.

Introduces a new shared to_windows_git_bash_style_path() helper in src/mdm/utils.rs — a companion to the to_git_bash_path() helper added in PR #603. While to_git_bash_path produces MSYS-style paths (/c/Users/...) for tools that run inside git bash (e.g. Claude Code hooks), to_windows_git_bash_style_path produces valid Windows paths with forward slashes (C:/Users/...) for native GUI apps that store paths in JSON settings files.

Changes

  • src/mdm/utils.rs: Added to_windows_git_bash_style_path(path) -> String — calls clean_path (strips \\?\ prefix) then replaces backslashes with forward slashes. Added two regression tests.
  • src/mdm/git_clients/fork_app.rs: Fork's Windows check_client and install_prefs now use to_windows_git_bash_style_path (via a thin fork_custom_git_instance_path wrapper) instead of raw to_string_lossy(). Added a Windows-only regression test asserting the output is C:/... (not MSYS /c/...).
  • src/mdm/git_clients/sublime_merge.rs: Refactored to use the same shared to_windows_git_bash_style_path helper instead of inline .replace('\\', "/"), for consistency and to also gain the clean_path prefix-stripping.

Review & Testing Checklist for Human

  • On a Windows machine with Fork installed, run git-ai install-hooks and confirm Fork accepts the configured custom git path and the setting persists after restarting Fork.
  • Verify %LOCALAPPDATA%\Fork\settings.json has CustomGitInstancePath set to a valid C:/.../git.exe path (not backslashes, not MSYS /c/...).
  • Verify that re-running git-ai install-hooks is a no-op (i.e., check_client correctly detects "up-to-date"). Note: if an existing installation previously stored a backslash path, the first run after this change will re-write it — this is expected.
  • Verify Sublime Merge still works correctly on Windows — the refactor to use to_windows_git_bash_style_path also adds clean_path prefix-stripping, which is a minor behavior change if paths ever had the \\?\ extended prefix.

Notes

  • Requested by @svarlamov
  • Link to Devin run
  • This fix cannot be meaningfully end-to-end tested outside of a real Windows environment with Fork/Sublime Merge installed.
  • The Fork-specific regression test is gated behind #[cfg(all(test, windows))], so it only runs on Windows CI runners.
**Original Pull Request:** https://github.com/git-ai-project/git-ai/pull/608 **State:** closed **Merged:** Yes --- # fix: Fork on Windows store forward-slash path (fixes #606) ## Summary Fixes #606 by updating the Fork Windows installer integration to store and compare a **valid Windows path with forward slashes** (e.g. `C:/Users/.../git.exe`) for `CustomGitInstancePath`. Introduces a new shared `to_windows_git_bash_style_path()` helper in `src/mdm/utils.rs` — a companion to the `to_git_bash_path()` helper added in PR #603. While `to_git_bash_path` produces MSYS-style paths (`/c/Users/...`) for tools that run inside git bash (e.g. Claude Code hooks), `to_windows_git_bash_style_path` produces valid Windows paths with forward slashes (`C:/Users/...`) for native GUI apps that store paths in JSON settings files. ### Changes - **`src/mdm/utils.rs`**: Added `to_windows_git_bash_style_path(path) -> String` — calls `clean_path` (strips `\\?\` prefix) then replaces backslashes with forward slashes. Added two regression tests. - **`src/mdm/git_clients/fork_app.rs`**: Fork's Windows `check_client` and `install_prefs` now use `to_windows_git_bash_style_path` (via a thin `fork_custom_git_instance_path` wrapper) instead of raw `to_string_lossy()`. Added a Windows-only regression test asserting the output is `C:/...` (not MSYS `/c/...`). - **`src/mdm/git_clients/sublime_merge.rs`**: Refactored to use the same shared `to_windows_git_bash_style_path` helper instead of inline `.replace('\\', "/")`, for consistency and to also gain the `clean_path` prefix-stripping. ## Review & Testing Checklist for Human - [ ] On a Windows machine with Fork installed, run `git-ai install-hooks` and confirm Fork accepts the configured custom git path and the setting persists after restarting Fork. - [ ] Verify `%LOCALAPPDATA%\Fork\settings.json` has `CustomGitInstancePath` set to a valid `C:/.../git.exe` path (not backslashes, not MSYS `/c/...`). - [ ] Verify that re-running `git-ai install-hooks` is a no-op (i.e., `check_client` correctly detects "up-to-date"). Note: if an existing installation previously stored a backslash path, the first run after this change will re-write it — this is expected. - [ ] Verify Sublime Merge still works correctly on Windows — the refactor to use `to_windows_git_bash_style_path` also adds `clean_path` prefix-stripping, which is a minor behavior change if paths ever had the `\\?\` extended prefix. ### Notes - Requested by @svarlamov - [Link to Devin run](https://app.devin.ai/sessions/d5c74ee8e2244151958a4452a1fefe71) - This fix cannot be meaningfully end-to-end tested outside of a real Windows environment with Fork/Sublime Merge installed. - The Fork-specific regression test is gated behind `#[cfg(all(test, windows))]`, so it only runs on Windows CI runners.
kerem 2026-03-02 04:14:05 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/git-ai#605
No description provided.