Files
oh-my-zsh/lib
Robby RussellandClaude Fable 5.1 01bbde85c4 perf(git): fork git less often for the prompt
`_omz_git_prompt_info` ran `git rev-parse --git-dir` and then
`git symbolic-ref --short HEAD` as two separate processes. Ask for both
in one `git rev-parse --git-dir --abbrev-ref HEAD` call; a detached HEAD
prints "HEAD" and falls through to the tag/SHA lookups as before, and an
unborn branch (exit 128 after printing the git dir) falls back to
`symbolic-ref` so freshly initialised repositories still show their
branch.

`parse_git_dirty` piped `git status --porcelain` through `tail -n 1`,
but only tests whether the output is empty, so the pipe is dropped.

Output verified identical for: outside a repo, unborn, unborn with
staged files, clean, dirty, detached, detached on a tag, hide-info,
hide-dirty, subdirectory. Two fewer forks per prompt; ~13 ms less on
macOS arm64 for a clean branch.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-06 08:08:19 -07:00
..
2025-07-21 18:39:25 +02:00
2024-11-21 09:01:48 +01:00
2022-01-03 13:50:50 +01:00