mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-13 03:01:32 +01:00
Updates git_prompt_sha.
This commit is contained in:
parent
bacb4a7778
commit
e3e980a16d
1 changed files with 10 additions and 9 deletions
19
lib/git.zsh
19
lib/git.zsh
|
|
@ -19,10 +19,13 @@
|
||||||
# To ignore untracked files making your branch dirty, set
|
# To ignore untracked files making your branch dirty, set
|
||||||
# DISABLE_UNTRACKED_FILES_DIRTY to 'true'
|
# DISABLE_UNTRACKED_FILES_DIRTY to 'true'
|
||||||
#
|
#
|
||||||
# git_prompt_short_sha and git_prompt_long_sha
|
# git_prompt_sha
|
||||||
# Delimited by
|
# Delimited by
|
||||||
# ZSH_THEME_GIT_PROMPT_SHA_BEFORE
|
# ZSH_THEME_GIT_PROMPT_SHA_BEFORE
|
||||||
# ZSH_THEME_GIT_PROMPT_SHA_AFTER
|
# ZSH_THEME_GIT_PROMPT_SHA_AFTER
|
||||||
|
# By default displays the long sha key, call git_prompt_sha --short
|
||||||
|
# to have it shortened. The former functions git_prompt_long_sha and
|
||||||
|
# git_prompt_short_sha are kept for backward compatibility.
|
||||||
#
|
#
|
||||||
# git_remote_status
|
# git_remote_status
|
||||||
# Shows the difference between your local and its remote branch. Checks
|
# Shows the difference between your local and its remote branch. Checks
|
||||||
|
|
@ -68,17 +71,15 @@ git_is_clean() {
|
||||||
[[ $(command git status -s $GIT_STATUS_OPTIONS 2> /dev/null) == '' ]]
|
[[ $(command git status -s $GIT_STATUS_OPTIONS 2> /dev/null) == '' ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
# Formats prompt string for current git commit short SHA
|
# Shows the long git sha, pass in --short to get it shortened
|
||||||
git_prompt_short_sha() {
|
git_prompt_sha() {
|
||||||
SHA=$(command git rev-parse --short HEAD 2> /dev/null) && \
|
SHA=$(command git rev-parse $1 HEAD 2> /dev/null) && \
|
||||||
echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER"
|
echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Formats prompt string for current git commit long SHA
|
# The following are kept for backwards compatibility
|
||||||
git_prompt_long_sha() {
|
git_prompt_short_sha() { git_prompt_sha --short }
|
||||||
SHA=$(command git rev-parse HEAD 2> /dev/null) && \
|
git_prompt_long_sha() { git_prompt_sha }
|
||||||
echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER"
|
|
||||||
}
|
|
||||||
|
|
||||||
# get the difference between the local and remote branches
|
# get the difference between the local and remote branches
|
||||||
git_remote_status() {
|
git_remote_status() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue