Skip to content

Fix the git path fallback freezing launch when validation fails - #766

Merged
hannesa2 merged 1 commit into
masterfrom
keep-the-git-path-until-a-fallback-is-found
Oct 25, 2026
Merged

hannesa2 merged 1 commit into
masterfrom
keep-the-git-path-until-a-fallback-is-found

Conversation

@goneng

@goneng goneng commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator

Run the default git search off the main thread and keep the configured path until a replacement is found, so a failed background check no longer blocks the UI or leaves the git path nil while the search runs.

This continues #748 for #744, which was reported again on 1.7.1. This PR alone does not fix #744 and does not close it. Manual testing found the likely root cause: a race in PBTask that sometimes returns empty output for a successful git --version when many instances start at once. That is fixed separately in #774. This PR remains useful on top of it: a configured path that fails validation no longer blocks startup, and falls back to a working git.

  • Search for a default git binary on the background queue without touching the shared state
  • Switch to the binary found and show the alert on the main thread
  • Keep the configured path when no fallback is found
  • Build the search locations list once, as it is now read off the main thread
  • Log which binary replaced the configured one

Refs #744, see also #774

Test plan (run on the CI arm64 build of this branch):

  • Launch normally: no alert, repo opens
  • Launch with -gitExecutable pointing at a script that exits 1: the log shows the failed validation and the binary used instead (/opt/homebrew/bin/git), the alert is shown, the app stays usable
  • Launch with -gitExecutable pointing at a script that sleeps 8 s before running git: the UI is responsive during the wait, and no alert appears
  • Launch about a dozen repositories at once: reproduced the empty git --version output now fixed in Fix commands sometimes returning empty output when many run at once #774
  • Launch with a missing path: alert shown immediately, as before

@goneng
goneng force-pushed the keep-the-git-path-until-a-fallback-is-found branch 2 times, most recently from 0382ba7 to 09c55b0 Compare October 24, 2026 07:36
@goneng goneng added the bugfix label Oct 24, 2026
Run the default git search off the main thread and keep the configured path until a replacement is found, so a failed background check no longer blocks the UI or leaves the git path nil while the search runs.

- Search for a default git binary on the background queue without touching the shared state
- Switch to the binary found and show the alert on the main thread
- Keep the configured path when no fallback is found
- Build the search locations list once, as it is now read off the main thread
- Log which binary replaced the configured one

Refs #744
@goneng

goneng commented Oct 24, 2026

Copy link
Copy Markdown
Collaborator Author

Manual testing of the CI arm64 build covered the failing-git, slow-git (8 s) and many-instances cases. The first two behave as described. The many-instances run showed a separate cause of #744, fixed in #774, which should be merged first.

@goneng
goneng marked this pull request as ready for review October 24, 2026 17:55
@goneng
goneng requested a review from hannesa2 October 24, 2026 18:04

@hannesa2 hannesa2 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conclusion: A good, targeted concurrency fix that correctly addresses the root cause of the UI freeze and is consistent with the existing code. I would merge it.

@hannesa2
hannesa2 merged commit 574bfc3 into master Oct 25, 2026
5 of 6 checks passed
@hannesa2
hannesa2 deleted the keep-the-git-path-until-a-fallback-is-found branch October 25, 2026 05:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

git path warning dialog on startup

2 participants