plugins: Rename gitstatusd plugin to gitstatus

This commit is contained in:
Noah Gorny
2020-06-21 12:54:53 +03:00
parent 6294797986
commit 3eac73f613
8 changed files with 44 additions and 44 deletions

View File

@@ -34,8 +34,8 @@ SCM_GIT_SHOW_CURRENT_USER=${SCM_GIT_SHOW_CURRENT_USER:=false}
SCM_GIT_SHOW_MINIMAL_INFO=${SCM_GIT_SHOW_MINIMAL_INFO:=false}
SCM_GIT_SHOW_STASH_INFO=${SCM_GIT_SHOW_STASH_INFO:=true}
SCM_GIT_SHOW_COMMIT_COUNT=${SCM_GIT_SHOW_COMMIT_COUNT:=true}
SCM_GIT_USE_GITSTATUSD=${SCM_GIT_USE_GITSTATUSD:=false}
SCM_GIT_GITSTATUSD_RAN=${SCM_GIT_GITSTATUSD_RAN:=false}
SCM_GIT_USE_GITSTATUS=${SCM_GIT_USE_GITSTATUS:=false}
SCM_GIT_GITSTATUS_RAN=${SCM_GIT_GITSTATUS_RAN:=false}
SCM_GIT='git'
SCM_GIT_CHAR='±'
@@ -193,10 +193,10 @@ function git_prompt_minimal_info {
}
function git_prompt_vars {
if ${SCM_GIT_USE_GITSTATUSD} && _command_exists gitstatus_query && gitstatus_query && [[ "${VCS_STATUS_RESULT}" == "ok-sync" ]]; then # use faster gitstatusd
SCM_GIT_GITSTATUSD_RAN=true # use this in githelpers and below to choose gitstatusd output
if ${SCM_GIT_USE_GITSTATUS} && _command_exists gitstatus_query && gitstatus_query && [[ "${VCS_STATUS_RESULT}" == "ok-sync" ]]; then # use faster gitstatus
SCM_GIT_GITSTATUS_RAN=true # use this in githelpers and below to choose gitstatus output
else
SCM_GIT_GITSTATUSD_RAN=false
SCM_GIT_GITSTATUS_RAN=false
fi
if _git-branch &> /dev/null; then
@@ -214,7 +214,7 @@ function git_prompt_vars {
SCM_BRANCH="${detached_prefix}\$(_git-friendly-ref)"
fi
if [[ "${SCM_GIT_GITSTATUSD_RAN}" == "true" ]]; then
if [[ "${SCM_GIT_GITSTATUS_RAN}" == "true" ]]; then
commits_behind=${VCS_STATUS_COMMITS_BEHIND}
commits_ahead=${VCS_STATUS_COMMITS_AHEAD}
else
@@ -231,7 +231,7 @@ function git_prompt_vars {
if [[ "${SCM_GIT_SHOW_STASH_INFO}" = "true" ]]; then
local stash_count
if [[ "${SCM_GIT_GITSTATUSD_RAN}" == "true" ]]; then
if [[ "${SCM_GIT_GITSTATUS_RAN}" == "true" ]]; then
stash_count=${VCS_STATUS_STASHES}
else
stash_count="$(git stash list 2> /dev/null | wc -l | tr -d ' ')"
@@ -241,7 +241,7 @@ function git_prompt_vars {
SCM_STATE=${GIT_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN}
if ! _git-hide-status; then
if [[ "${SCM_GIT_GITSTATUSD_RAN}" == "true" ]]; then
if [[ "${SCM_GIT_GITSTATUS_RAN}" == "true" ]]; then
untracked_count=${VCS_STATUS_NUM_UNTRACKED}
unstaged_count=${VCS_STATUS_NUM_UNSTAGED}
staged_count=${VCS_STATUS_NUM_STAGED}
@@ -259,7 +259,7 @@ function git_prompt_vars {
fi
fi
# no if for gitstatusd here, user extraction is not supported by it
# no if for gitstatus here, user extraction is not supported by it
[[ "${SCM_GIT_SHOW_CURRENT_USER}" == "true" ]] && SCM_BRANCH+="$(git_user_info)"
SCM_PREFIX=${GIT_THEME_PROMPT_PREFIX:-$SCM_THEME_PROMPT_PREFIX}

View File

@@ -9,7 +9,7 @@ function _git-symbolic-ref {
# same commit. _git-branch is used to explicitly choose the checked-out
# branch.
function _git-branch {
if [[ "${SCM_GIT_GITSTATUSD_RAN}" == "true" ]]; then
if [[ "${SCM_GIT_GITSTATUS_RAN}" == "true" ]]; then
test -n "${VCS_STATUS_LOCAL_BRANCH}" && echo "${VCS_STATUS_LOCAL_BRANCH}" || return 1
else
git symbolic-ref -q --short HEAD 2> /dev/null || return 1
@@ -17,7 +17,7 @@ function _git-branch {
}
function _git-tag {
if [[ "${SCM_GIT_GITSTATUSD_RAN}" == "true" ]]; then
if [[ "${SCM_GIT_GITSTATUS_RAN}" == "true" ]]; then
test -n "${VCS_STATUS_TAG}" && echo "${VCS_STATUS_TAG}"
else
git describe --tags --exact-match 2> /dev/null
@@ -29,7 +29,7 @@ function _git-commit-description {
}
function _git-short-sha {
if [[ "${SCM_GIT_GITSTATUSD_RAN}" == "true" ]]; then
if [[ "${SCM_GIT_GITSTATUS_RAN}" == "true" ]]; then
echo ${VCS_STATUS_COMMIT:0:7}
else
git rev-parse --short HEAD
@@ -38,8 +38,8 @@ function _git-short-sha {
# Try the checked-out branch first to avoid collision with branches pointing to the same ref.
function _git-friendly-ref {
if [[ "${SCM_GIT_GITSTATUSD_RAN}" == "true" ]]; then
_git-branch || _git-tag || _git-short-sha # there is no tag based describe output in gitstatusd
if [[ "${SCM_GIT_GITSTATUS_RAN}" == "true" ]]; then
_git-branch || _git-tag || _git-short-sha # there is no tag based describe output in gitstatus
else
_git-branch || _git-tag || _git-commit-description || _git-short-sha
fi
@@ -119,7 +119,7 @@ function _git-status-counts {
function _git-remote-info {
# prompt handling only, reimplement because patching the routine below gets ugly
if [[ "${SCM_GIT_GITSTATUSD_RAN}" == "true" ]]; then
if [[ "${SCM_GIT_GITSTATUS_RAN}" == "true" ]]; then
[[ "${VCS_STATUS_REMOTE_NAME}" == "" ]] && return
[[ "${VCS_STATUS_LOCAL_BRANCH}" == "${VCS_STATUS_REMOTE_BRANCH}" ]] && local same_branch_name=true
local same_branch_name=