mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-06-05 05:03:16 +02:00
agnoster: compute git repo_path only when in a git repo
this avoids needlessly invoking git twice every time we render the prompt
This commit is contained in:
parent
015e6242aa
commit
a8319ef0b3
1 changed files with 1 additions and 1 deletions
|
|
@ -94,9 +94,9 @@ prompt_git() {
|
|||
PL_BRANCH_CHAR=$'\ue0a0' #
|
||||
}
|
||||
local ref dirty mode repo_path
|
||||
repo_path=$(git rev-parse --git-dir 2>/dev/null)
|
||||
|
||||
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
|
||||
repo_path=$(git rev-parse --git-dir 2>/dev/null)
|
||||
dirty=$(parse_git_dirty)
|
||||
ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git rev-parse --short HEAD 2> /dev/null)"
|
||||
if [[ -n $dirty ]]; then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue