PR Description
Problem
The Git prompt in Oh My Zsh is extremely slow (2–5 seconds) in large repositories, especially on machines with file/network auditing (like office Macs).
The slowdown is caused by:
git status --porcelain -b scanning untracked files
Repeated git rev-list and show-ref calls
Solution
Introduced a lightweight fix using the existing DISABLE_UNTRACKED_FILES_DIRTY environment variable.
When set to true, the prompt skips scanning untracked files:
DISABLE_UNTRACKED_FILES_DIRTY=true
Updated _omz_git_prompt_status to respect this variable.
All other prompt behavior remains unchanged.
How to Use
Add to your .zshrc before sourcing Oh My Zsh:
export DISABLE_UNTRACKED_FILES_DIRTY=true
Reload the shell:
exec zsh
Before vs After
Action Before After
Enter large Git repo ~2–5s delay <0.5s
Tab completion for branches 4–5s delay <0.2s
Prompt shows branch Yes Yes
Additional Notes
Optional: users can still disable the status portion entirely with:
export DISABLE_GIT_PROMPT_STATUS=true
Fully backward compatible.
Related Issue
Fixes#13082
The convention to use `.venv` or `venv` directories for Python virtualenvs is widespread.
This directory is huge and gives very little value when grepping in a source code directory.
Co-authored-by: Marc Cornellà <marc@mcornella.com>
Logic error in `history -c` when prompting for confirmation caused history
to be deleted when typing anything but explicitly `n`, `N`, or sending `\n`.
New logic prevents deletion by pressing wrong key and only deletes
history when sending `y` or `Y`.
Co-authored-by: Sargates <nicholas.g.glenn@gmail.com>
We removed this mitigation in 0c80a063 because of an assumption
that the issue had been fixed, but it looks like zsh < 5.0.6 has
other issues (see #12360), so we need to disable it for real.
Fixes#12360
The `t` option takes a strftime format specification as argument. This
fixes cases in which $HIST_STAMPS is set to a value other than
`mm/dd/yyyy|dd.mm.yyyy|yyyy-mm-dd`.
* Fixed a bug in *omz_history* where it would automatically create a file when run with the -p flag
* Reverted old history behaviour while fixing parsing bug
BREAKING CHANGE: we have fixed a bug in the `history` wrapper for OMZ which means
that running just history will now not show all the history since the 1st command,
but only recent ones. To get the previous behavior, you can run `history 1` to get
all the command history, or other commands such as `history -30` to get the last
30 commands.
This is important for themes using it, since it is usually a little slower than git_prompt_info.
Also two small fixes :
- the handler for git_prompt_info was incorrectly named _omz_git_prompt_status
- _defer_async_git_register was kept in precmd, there is no need to call it on each prompt
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.