|
|
@ -218,9 +218,11 @@ function git-info() { |
|
|
|
# Get commit. |
|
|
|
# Get commit. |
|
|
|
commit="$(git rev-parse HEAD 2>/dev/null)" |
|
|
|
commit="$(git rev-parse HEAD 2>/dev/null)" |
|
|
|
|
|
|
|
|
|
|
|
# Format commit (short). |
|
|
|
# Format commit. |
|
|
|
zstyle -s ':omz:plugin:git:prompt' commit 'commit_format' |
|
|
|
if [[ -n "$commit" ]]; then |
|
|
|
zformat -f commit_formatted "$commit_format" "c:$commit" |
|
|
|
zstyle -s ':omz:plugin:git:prompt' commit 'commit_format' |
|
|
|
|
|
|
|
zformat -f commit_formatted "$commit_format" "c:$commit" |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
# Stashed |
|
|
|
# Stashed |
|
|
|
if [[ -f "$(_git-dir)/refs/stash" ]]; then |
|
|
|
if [[ -f "$(_git-dir)/refs/stash" ]]; then |
|
|
@ -238,6 +240,8 @@ function git-info() { |
|
|
|
if (( line_number == 1 )) && [[ "$line" == *'(no branch)'* ]]; then |
|
|
|
if (( line_number == 1 )) && [[ "$line" == *'(no branch)'* ]]; then |
|
|
|
# Get action. |
|
|
|
# Get action. |
|
|
|
action="$(_git-action)" |
|
|
|
action="$(_git-action)" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Format action. |
|
|
|
if [[ -n "$action" ]]; then |
|
|
|
if [[ -n "$action" ]]; then |
|
|
|
zstyle -s ':omz:plugin:git:prompt' action 'action_format' |
|
|
|
zstyle -s ':omz:plugin:git:prompt' action 'action_format' |
|
|
|
zformat -f action_formatted "$action_format" "s:$action" |
|
|
|
zformat -f action_formatted "$action_format" "s:$action" |
|
|
@ -287,11 +291,11 @@ function git-info() { |
|
|
|
done < <("${(z)status_cmd}" 2>/dev/null) |
|
|
|
done < <("${(z)status_cmd}" 2>/dev/null) |
|
|
|
|
|
|
|
|
|
|
|
# Format branch. |
|
|
|
# Format branch. |
|
|
|
zstyle -s ':omz:plugin:git:prompt' branch 'branch_format' |
|
|
|
if [[ -n "$branch" ]]; then |
|
|
|
zformat -f branch_formatted "$branch_format" "b:$branch" |
|
|
|
zstyle -s ':omz:plugin:git:prompt' branch 'branch_format' |
|
|
|
|
|
|
|
zformat -f branch_formatted "$branch_format" "b:$branch" |
|
|
|
|
|
|
|
|
|
|
|
# Format remote. |
|
|
|
# Format remote. |
|
|
|
if [[ "$branch" != "$commit" ]]; then |
|
|
|
|
|
|
|
if [[ -z "$remote" ]]; then |
|
|
|
if [[ -z "$remote" ]]; then |
|
|
|
remote="${$( \ |
|
|
|
remote="${$( \ |
|
|
|
git rev-parse \ |
|
|
|
git rev-parse \ |
|
|
|