Diff
1diff --git a/README.md b/README.md
2index 78db3a88fc92d8814b02e31ced4878c24068335d..1303292d25c0f36ba44d8c207711ea1604f8d9ef 100644
3--- a/README.md
4+++ b/README.md
5@@ -48,7 +48,7 @@ Twitter), and join us on [Discord](https://discord.gg/ohmyzsh).
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+ - [Async git prompt](#async-git-prompt)
11 - [Getting Updates](#getting-updates)
12 - [Updates Verbosity](#updates-verbosity)
13 - [Manual Updates](#manual-updates)
14@@ -415,7 +415,7 @@ zstyle ':omz:lib:directories' aliases no
15 > It is also not currently aware of "aliases" that are defined as functions. Example of such are `gccd`,
16 > `ggf`, or `ggl` functions from the git plugin.
17
18-### Disable async git prompt
19+### Async git prompt
20
21 Async prompt functions are an experimental feature (included on April 3, 2024) that allows Oh My Zsh to render
22 prompt information asynchronously. This can improve prompt rendering performance, but it might not work well
23@@ -426,6 +426,14 @@ turn it off by setting the following in your .zshrc file, before Oh My Zsh is so
24 zstyle ':omz:alpha:lib:git' async-prompt no
25 ```
26
27+If your problem is that the git prompt just stopped appearing, you can try to force it setting the following
28+configuration before `oh-my-zsh.sh` is sourced. If it still does not work, please open an issue with your
29+case.
30+
31+```sh
32+zstyle ':omz:alpha:lib:git' async-prompt force
33+```
34+
35 ## Getting Updates
36
37 By default, you will be prompted to check for updates every 2 weeks. You can choose other update modes by
38diff --git a/lib/git.zsh b/lib/git.zsh
39index 0efff3e075d6d14b741d558b9228f25fcb988d6d..a1b4d15874bb41e5f85605510efc5e5f1ecdcfe6 100644
40--- a/lib/git.zsh
41+++ b/lib/git.zsh
42@@ -44,6 +44,7 @@ function _omz_git_prompt_info() {
43 # - https://github.com/ohmyzsh/ohmyzsh/issues/12331
44 # - https://github.com/ohmyzsh/ohmyzsh/issues/12360
45 # TODO(2024-06-12): @mcornella remove workaround when CentOS 7 reaches EOL
46+local _style
47 if zstyle -t ':omz:alpha:lib:git' async-prompt \
48 || { is-at-least 5.0.6 && zstyle -T ':omz:alpha:lib:git' async-prompt }; then
49 function git_prompt_info() {
50@@ -81,6 +82,21 @@ if zstyle -t ':omz:alpha:lib:git' async-prompt \
51 # Register the async handler first. This needs to be done before
52 # the async request prompt is run
53 precmd_functions=(_defer_async_git_register $precmd_functions)
54+elif zstyle -s ':omz:alpha:lib:git' async-prompt _style && [[ $_style == "force" ]]; then
55+ function git_prompt_info() {
56+ if [[ -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_info]}" ]]; then
57+ echo -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_info]}"
58+ fi
59+ }
60+
61+ function git_prompt_status() {
62+ if [[ -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_status]}" ]]; then
63+ echo -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_status]}"
64+ fi
65+ }
66+
67+ _omz_register_handler _omz_git_prompt_info
68+ _omz_register_handler _omz_git_prompt_status
69 else
70 function git_prompt_info() {
71 _omz_git_prompt_info