From f4609b896fac842433bd495c166d5987852a6a73 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 21 Nov 2020 19:20:35 +0100 Subject: merge(3p/git): Merge git subtree at v2.29.2 This also bumps the stable nixpkgs to 20.09 as of 2020-11-21, because there is some breakage in the git build related to the netrc credentials helper which someone has taken care of in nixpkgs. The stable channel is not used for anything other than git, so this should be fine. Change-Id: I3575a19dab09e1e9556cf8231d717de9890484fb --- third_party/git/contrib/completion/git-prompt.sh | 32 ++++++++++++++++++------ 1 file changed, 25 insertions(+), 7 deletions(-) (limited to 'third_party/git/contrib/completion/git-prompt.sh') diff --git a/third_party/git/contrib/completion/git-prompt.sh b/third_party/git/contrib/completion/git-prompt.sh index 1d510cd47b..16260bab73 100644 --- a/third_party/git/contrib/completion/git-prompt.sh +++ b/third_party/git/contrib/completion/git-prompt.sh @@ -70,6 +70,15 @@ # state symbols by setting GIT_PS1_STATESEPARATOR. The default separator # is SP. # +# When there is an in-progress operation such as a merge, rebase, +# revert, cherry-pick, or bisect, the prompt will include information +# related to the operation, often in the form "|". +# +# When the repository has a sparse-checkout, a notification of the form +# "|SPARSE" will be included in the prompt. This can be shortened to a +# single '?' character by setting GIT_PS1_COMPRESSSPARSESTATE, or omitted +# by setting GIT_PS1_OMITSPARSESTATE. +# # By default, __git_ps1 will compare HEAD to your SVN upstream if it can # find one, or @{upstream} otherwise. Once you have set # GIT_PS1_SHOWUPSTREAM, you can override it on a per-repository basis by @@ -421,6 +430,13 @@ __git_ps1 () return $exit fi + local sparse="" + if [ -z "${GIT_PS1_COMPRESSSPARSESTATE}" ] && + [ -z "${GIT_PS1_OMITSPARSESTATE}" ] && + [ "$(git config --bool core.sparseCheckout)" = "true" ]; then + sparse="|SPARSE" + fi + local r="" local b="" local step="" @@ -429,11 +445,7 @@ __git_ps1 () __git_eread "$g/rebase-merge/head-name" b __git_eread "$g/rebase-merge/msgnum" step __git_eread "$g/rebase-merge/end" total - if [ -f "$g/rebase-merge/interactive" ]; then - r="|REBASE-i" - else - r="|REBASE-m" - fi + r="|REBASE" else if [ -d "$g/rebase-apply" ]; then __git_eread "$g/rebase-apply/next" step @@ -496,6 +508,7 @@ __git_ps1 () local i="" local s="" local u="" + local h="" local c="" local p="" @@ -528,6 +541,11 @@ __git_ps1 () u="%${ZSH_VERSION+%}" fi + if [ -n "${GIT_PS1_COMPRESSSPARSESTATE}" ] && + [ "$(git config --bool core.sparseCheckout)" = "true" ]; then + h="?" + fi + if [ -n "${GIT_PS1_SHOWUPSTREAM-}" ]; then __git_ps1_show_upstream fi @@ -546,8 +564,8 @@ __git_ps1 () b="\${__git_ps1_branch_name}" fi - local f="$w$i$s$u" - local gitstring="$c$b${f:+$z$f}$r$p" + local f="$h$w$i$s$u" + local gitstring="$c$b${f:+$z$f}${sparse}$r$p" if [ $pcmode = yes ]; then if [ "${__git_printf_supports_v-}" != yes ]; then -- cgit 1.4.1