ec1afe9dd683c36e6384db25fc1e95acbb0cbc7a

Author
Marc Cornellà <marc@mcornella.com>
Committer
Marc Cornellà <marc@mcornella.com>
Date

Message

feat(git)!: enable async git prompt (now for real)

BREAKING CHANGE: the new async prompt feature will render prompt information
asyncronously and degrade nicely when the calls take too long to finish, as
the prompt will already be first drawn and interactive. This is
enabled by default for the git prompt and themes that use it (`git_prompt_info`).
If you find that it's not working for you, please open an issue if one is
not already opened, and see https://github.com/ohmyzsh/ohmyzsh#disable-async-git-prompt
for how to turn it off.

Diff

 1diff --git a/README.md b/README.md
 2index b3561a833d40b3ed30f60afce95ae2017daa698d..2ba374335e8edbe57beff0febac72b2e3f219150 100644
 3--- a/README.md
 4+++ b/README.md
 5@@ -43,6 +43,7 @@ To learn more, visit [ohmyz.sh](https://ohmyz.sh), follow [@ohmyzsh](https://twi
 6   - [Custom Plugins And Themes](#custom-plugins-and-themes)
 7   - [Enable GNU ls In macOS And freeBSD Systems](#enable-gnu-ls-in-macos-and-freebsd-systems)
 8   - [Skip Aliases](#skip-aliases)
 9+  - [Disable async git prompt](#disable-async-git-prompt)
10 - [Getting Updates](#getting-updates)
11   - [Updates Verbosity](#updates-verbosity)
12   - [Manual Updates](#manual-updates)
13@@ -361,6 +362,17 @@ Instead, you can now use the following:
14 zstyle ':omz:lib:directories' aliases no
15 ```
16 
17+### Disable async git prompt
18+
19+Async prompt functions are an experimental feature (included on April 3, 2024) that allows Oh My Zsh to render prompt information
20+asyncronously. This can improve prompt rendering performance, but it might not work well with some setups. We hope that's not an
21+issue, but if you're seeing problems with this new feature, you can turn it of by setting the following in your .zshrc file,
22+before Oh My Zsh is sourced:
23+
24+```sh
25+zstyle ':omz:alpha:lib:git' async-prompt no
26+```
27+
28 #### Notice <!-- omit in toc -->
29 
30 > This feature is currently in a testing phase and it may be subject to change in the future.
31diff --git a/lib/git.zsh b/lib/git.zsh
32index 96df5589dfb931cc1c08ddb035280377cf14aae4..4d6681c5b086a35162c4188936211c9b78265532 100644
33--- a/lib/git.zsh
34+++ b/lib/git.zsh
35@@ -38,7 +38,7 @@ function _omz_git_prompt_status() {
36 }
37 
38 # Enable async prompt by default unless the setting is at false / no
39-if zstyle -t ':omz:alpha:lib:git' async-prompt; then
40+if zstyle -T ':omz:alpha:lib:git' async-prompt; then
41   function git_prompt_info() {
42     if [[ -n "$_OMZ_ASYNC_OUTPUT[_omz_git_prompt_status]" ]]; then
43       echo -n "$_OMZ_ASYNC_OUTPUT[_omz_git_prompt_status]"