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