Updates git_prompt_sha.

This commit is contained in:
LFDM 2014-01-05 17:22:09 +01:00
commit e3e980a16d

View file

@ -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() {