Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GIT INFORMATION NOT APPEARING IN PROMPT #12267

Closed
vanniktech opened this issue Mar 7, 2024 · 15 comments
Closed

GIT INFORMATION NOT APPEARING IN PROMPT #12267

vanniktech opened this issue Mar 7, 2024 · 15 comments

Comments

@vanniktech
Copy link

vanniktech commented Mar 7, 2024

Describe the bug

I've just ran omz update and now it does not seem to work correctly; but neither do I know how I would debug this

Steps to reproduce

Update from the version that I had to the current and suddenly my git configuration is gone.

Expected behavior

It'd keep my git configuration as outlined in the first screenshot.

Screenshots and recordings

Before it used to display everything correctly:

Screenshot 2024-03-07 at 16 26 45

But now it is missing all the informations:

Screenshot 2024-03-07 at 16 27 04

OS / Linux distribution

macOS Sonoma 14.3.1

Zsh version

5.9

Terminal emulator

iTerm2

If using WSL on Windows, which version of WSL

None

Additional context

No response

@dianligegege
Copy link

I had the same problem, I switched to the previous version first.

git checkout <commit-hash>

@tyrken
Copy link

tyrken commented Mar 7, 2024

See workaround in #12257

@vivekbisen
Copy link

vivekbisen commented Mar 7, 2024

See workaround in #12257

tl;dr: Add this to your .zshrc and run omz reload

zstyle ':omz:alpha:lib:git' async-prompt no

@carlosala
Copy link
Member

The new feature has been disabled temporarely. Running omz update will fix the problem.

@carlosala carlosala pinned this issue Mar 7, 2024
@carlosala carlosala changed the title omz update broke git configuration GIT INFORMATION NOT APPEARING IN PROMPT Mar 7, 2024
mcornella added a commit that referenced this issue Mar 9, 2024
This fix conditionally registers the git prompt async handler only
if `git_prompt_info` is used anywhere in the prompt variables.

This is done in the proper order, so that the async request is
processed once the handler has been registered.

This fix also passes the return value of the previous command
to each of the async handlers, in case they are needed.
@mcornella
Copy link
Member

We found the culprit and I committed the fix in 06753e8. For now, the async prompt for git is turned off by default. You can however test it out with

zstyle ':omz:alpha:lib:git' async-prompt yes

We're quite proud of this one, and although it needs some work, we think it will get rid of all the "slow git prompt" issues, as it will now be rendered asynchronously.

Here's a recording of a before/after enabling on a shallow copy of the git repo https://github.com/torvalds/linux (which is a good test for slowness).

asciicast

Please test and send in your feedback! Thanks!!

@vanniktech
Copy link
Author

@mcornella that seems to be working fine on the first few runs. I must say that already on my small git repos I can feel the difference. Amazing work!

lesterchan added a commit to lesterchan/oh-my-zsh that referenced this issue Mar 16, 2024
* upstream/master: (90 commits)
  feat(gradle): update completion to version 25da917c (ohmyzsh#12287)
  fix(dependencies): copy gradle LICENSE
  feat(dependencies): enable gradle plugin
  docs: fix typos (ohmyzsh#12284)
  docs(pyenv): fix typo (ohmyzsh#12283)
  feat(extract): prefer using `pbzip2` instead of `bunzip2` (ohmyzsh#12280)
  docs(readme): add contributor list (ohmyzsh#12236)
  feat(fzf): add default fzf_base for msys2 (ohmyzsh#12274)
  fix(async): register the git prompt async handler correctly (ohmyzsh#12267)
  fix(git): disable temporarely async prompt
  feat(async)!: implement async prompt API and apply to git prompt (ohmyzsh#12257)
  feat(tools): update `supports_hyperlinks` (ohmyzsh#12258)
  chore(gitfast): remove update script (ohmyzsh#12262)
  perf(nvm): don't call `nvm version` on every cd
  feat(nvm)!: make `lazy` and `autoload` options compatible
  fix(nvm): remove zsh completion
  fix(terraform): fix completion repeating flags with value (ohmyzsh#12256)
  fix(terraform): pass `-chdir` to completion commands (ohmyzsh#12254)
  feat(python): add auto venv activation (ohmyzsh#12248)
  feat(terraform): update completion to `v1.7` (ohmyzsh#12252)
  ...
gerardo pushed a commit to gerardo/oh-my-zsh that referenced this issue Mar 19, 2024
* upstream/master: (212 commits)
  fix(docker-compose): completion regression (ohmyzsh#12288)
  feat(gradle): update completion to version 25da917c (ohmyzsh#12287)
  fix(dependencies): copy gradle LICENSE
  feat(dependencies): enable gradle plugin
  docs: fix typos (ohmyzsh#12284)
  docs(pyenv): fix typo (ohmyzsh#12283)
  feat(extract): prefer using `pbzip2` instead of `bunzip2` (ohmyzsh#12280)
  docs(readme): add contributor list (ohmyzsh#12236)
  feat(fzf): add default fzf_base for msys2 (ohmyzsh#12274)
  fix(async): register the git prompt async handler correctly (ohmyzsh#12267)
  fix(git): disable temporarely async prompt
  feat(async)!: implement async prompt API and apply to git prompt (ohmyzsh#12257)
  feat(tools): update `supports_hyperlinks` (ohmyzsh#12258)
  chore(gitfast): remove update script (ohmyzsh#12262)
  perf(nvm): don't call `nvm version` on every cd
  feat(nvm)!: make `lazy` and `autoload` options compatible
  fix(nvm): remove zsh completion
  fix(terraform): fix completion repeating flags with value (ohmyzsh#12256)
  fix(terraform): pass `-chdir` to completion commands (ohmyzsh#12254)
  feat(python): add auto venv activation (ohmyzsh#12248)
  ...
keenahn added a commit to keenahn/oh-my-zsh that referenced this issue Mar 22, 2024
* master: (223 commits)
  fix(mise): update environment when loading the plugin (ohmyzsh#12294)
  fix(docker-compose): completion regression (ohmyzsh#12288)
  feat(gradle): update completion to version 25da917c (ohmyzsh#12287)
  fix(dependencies): copy gradle LICENSE
  feat(dependencies): enable gradle plugin
  docs: fix typos (ohmyzsh#12284)
  docs(pyenv): fix typo (ohmyzsh#12283)
  feat(extract): prefer using `pbzip2` instead of `bunzip2` (ohmyzsh#12280)
  docs(readme): add contributor list (ohmyzsh#12236)
  feat(fzf): add default fzf_base for msys2 (ohmyzsh#12274)
  fix(async): register the git prompt async handler correctly (ohmyzsh#12267)
  fix(git): disable temporarely async prompt
  feat(async)!: implement async prompt API and apply to git prompt (ohmyzsh#12257)
  feat(tools): update `supports_hyperlinks` (ohmyzsh#12258)
  chore(gitfast): remove update script (ohmyzsh#12262)
  perf(nvm): don't call `nvm version` on every cd
  feat(nvm)!: make `lazy` and `autoload` options compatible
  fix(nvm): remove zsh completion
  fix(terraform): fix completion repeating flags with value (ohmyzsh#12256)
  fix(terraform): pass `-chdir` to completion commands (ohmyzsh#12254)
  ...
fdelacruz pushed a commit to fdelacruz/ohmyzsh that referenced this issue Mar 27, 2024
…12267)

This fix conditionally registers the git prompt async handler only
if `git_prompt_info` is used anywhere in the prompt variables.

This is done in the proper order, so that the async request is
processed once the handler has been registered.

This fix also passes the return value of the previous command
to each of the async handlers, in case they are needed.
pull bot pushed a commit to kis87988/ohmyzsh that referenced this issue Mar 27, 2024
…12267)

This fix conditionally registers the git prompt async handler only
if `git_prompt_info` is used anywhere in the prompt variables.

This is done in the proper order, so that the async request is
processed once the handler has been registered.

This fix also passes the return value of the previous command
to each of the async handlers, in case they are needed.
@mcornella
Copy link
Member

This is now enabled by default since ec1afe9 after fixing some logic and performance issues.

Disabling it is done the same way, but you should not experience any issues and instead get the full awesomeness of async prompt.

Please comment here or reopen if you have any issues!

@hwalinga
Copy link
Contributor

hwalinga commented Apr 5, 2024

I still face problems. How would I be able to debug this one?

@mcornella
Copy link
Member

What problems? Ideally a screenshot or terminal output would be helpful.

@hwalinga
Copy link
Contributor

hwalinga commented Apr 5, 2024

Same problems as OP:

Before:

image

After:

image

theme: https://github.com/sobolevn/sobole-zsh-theme
zsh version: 5.9 (x86_64-debian-linux-gnu)
git version: 2.39.2
Debian GNU/Linux 12

@carlosala
Copy link
Member

I see, your theme uses a custom function print git information. We didn't take into account this situation. It's reproducible as well with minimal theme bundled in oh-my-zsh.

@coradinibr
Copy link

Same bug happening with theme pygmalion.
zstyle ':omz:alpha:lib:git' async-prompt yes or no doesn't make any difference.

OS / Linux distribution: macOS Sonoma 14.4.1
Zsh version: 5.9
Terminal emulator: iTerm2 3.4.23

@tomncooper
Copy link

@coradinibr I had the same issue, to fix it you have to switch the git info command in $HOME/.oh-my-zsh/themes/pygmalion.zsh-theme:

#local gitinfo=$(git_prompt_info)                                                       
local gitinfo=$(_omz_git_prompt_info)

@naveedkakal
Copy link

I was using a custom theme (bullet-train) and I needed to replace git_prompt_info call to _omz_git_prompt_info call and it worked again

@mcornella
Copy link
Member

mcornella commented Apr 9, 2024

Don't do this:

I was using a custom theme (bullet-train) and I needed to replace git_prompt_info call to _omz_git_prompt_info call and it worked again

Instead, add

zstyle ':omz:alpha:lib:git' async-prompt no

to your .zshrc file, before Oh My Zsh is sourced. This will temporarily disable the async prompt until we have a better fix. Relying on the current function names will break in the very near future.

Please track #12328 for updates.

@ohmyzsh ohmyzsh locked as resolved and limited conversation to collaborators Apr 9, 2024
@carlosala carlosala unpinned this issue May 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

10 participants