Peter Ammon dff454b1c7
Rework git detection for macOS
fish by default shows a git-aware prompt. Recall that on macOS, there are
two hazards we must avoid:

1. The command `/usr/bin/git` is installed by default. This command is not
actually git; instead it's a stub which pops open a dialog proposing to
install Xcode command line tools. Not a good experience.
2. Even after installing these tools, the first run of any `git` or other
command may be quite slow, because it's now a stub which invokes `xcrun`
which needs to populate a cache on a fresh boot. Another bad experience.

We previously attempted to fix this by having `xcrun` print out its cache
path and check if there's a file there. This worked because `xcrun` only
lazily created that file. However, this no longer works: `xcrun` now
eagerly creates the file, and only lazily populates it. Thus we think git
is ready, when it is not.

(This can be reproduced by running `xcrun --kill-cache` and then running
the default fish shell prompt - it will be slow).

Change the fix in the following way: using sh, run `/usr/bin/git --version;
touch /tmp/__fish_git_ready` in the background. Then detect the presence of
/tmp/__fish_git_ready as a mark that git is ready.

Fixes #10535
2024-11-09 12:46:06 -08:00
..
2019-05-05 12:09:25 +02:00
2023-04-26 19:38:10 +02:00
2019-05-05 12:09:25 +02:00
2020-11-22 14:39:48 +01:00
2024-06-24 14:30:37 -05:00
2022-06-08 21:23:43 +02:00
2022-08-02 00:42:37 -07:00
2022-01-27 16:21:22 -08:00
2022-01-27 16:21:22 -08:00
2024-04-15 08:31:16 +02:00
2021-12-02 02:22:40 -08:00
2023-12-25 18:46:23 +01:00
2023-06-01 18:20:19 +02:00
2022-01-27 16:21:22 -08:00
2022-04-23 16:35:52 -07:00