f43ee85d8f154fbc95229772cac93dec83b09188

Author
ohmyzsh[bot] <54982679+ohmyzsh[bot]@users.noreply.github.com>
Committer
GitHub <noreply@github.com>
Date

Message

feat(gitfast): update to version v2.0 (#12135)

Co-authored-by: ohmyzsh[bot] <54982679+ohmyzsh[bot]@users.noreply.github.com>

Diff

This diff is truncated to protect this page.

  1diff --git a/.github/dependencies.yml b/.github/dependencies.yml
  2index 8c46395d7b69790daacd86ae92adcc04325f1dcd..4d5a8fa802b101091c2a6b3c634b85eb1f9465aa 100644
  3--- a/.github/dependencies.yml
  4+++ b/.github/dependencies.yml
  5@@ -2,7 +2,7 @@ dependencies:
  6   plugins/gitfast:
  7     repo: felipec/git-completion
  8     branch: master
  9-    version: tag:v1.3.7
 10+    version: tag:v2.0
 11     postcopy: |
 12       set -e
 13       rm -rf git-completion.plugin.zsh Makefile README.adoc t tools
 14diff --git a/plugins/gitfast/git-completion.bash b/plugins/gitfast/git-completion.bash
 15index dd06b50480bab4b6053dc6295c44a46759c5d582..9a2045f26d8b92895e237c7dc4caf3ca9f553bda 100644
 16--- a/plugins/gitfast/git-completion.bash
 17+++ b/plugins/gitfast/git-completion.bash
 18@@ -58,6 +58,12 @@
 19 #
 20 #     When set to "1" suggest all options, including options which are
 21 #     typically hidden (e.g. '--allow-empty' for 'git commit').
 22+#
 23+#   GIT_COMPLETION_IGNORE_CASE
 24+#
 25+#     When set, uses for-each-ref '--ignore-case' to find refs that match
 26+#     case insensitively, even on systems with case sensitive file systems
 27+#     (e.g., completing tag name "FOO" on "git checkout f<TAB>").
 28 
 29 # The following functions are meant to modify COMPREPLY, which should not be
 30 # modified directly.  The purpose is to localize the modifications so it's
 31@@ -320,116 +326,6 @@ else
 32 	unset $(compgen -v __gitcomp_builtin_)
 33 fi
 34 
 35diff --git a/plugins/gitfast/git-prompt.sh b/plugins/gitfast/git-prompt.sh
 36index 1435548e004687fcc21a9e1b8922aa3bd39b8515..76ee4ab1e54965f6bf02afb5b562eb327d66ebac 100644
 37--- a/plugins/gitfast/git-prompt.sh
 38+++ b/plugins/gitfast/git-prompt.sh
 39@@ -84,6 +84,10 @@
 40 # single '?' character by setting GIT_PS1_COMPRESSSPARSESTATE, or omitted
 41 # by setting GIT_PS1_OMITSPARSESTATE.
 42 #
 43+# If you would like to see a notification on the prompt when there are
 44+# unresolved conflicts, set GIT_PS1_SHOWCONFLICTSTATE to "yes". The
 45+# prompt will include "|CONFLICT".
 46+#
 47 # If you would like to see more information about the identity of
 48 # commits checked out as a detached HEAD, set GIT_PS1_DESCRIBE_STYLE
 49 # to one of these values:
 50@@ -96,9 +100,7 @@
 51 #
 52 # If you would like a colored hint about the current dirty state, set
 53 # GIT_PS1_SHOWCOLORHINTS to a nonempty value. The colors are based on
 54-# the colored output of "git status -sb" and are available only when
 55-# using __git_ps1 for PROMPT_COMMAND or precmd in Bash,
 56-# but always available in Zsh.
 57+# the colored output of "git status -sb".
 58 #
 59 # If you would like __git_ps1 to do nothing in the case when the current
 60 # directory is set up to be ignored by git, then set
 61@@ -255,12 +257,12 @@ __git_ps1_colorize_gitstring ()
 62 		local c_lblue='%F{blue}'
 63 		local c_clear='%f'
 64 	else
 65-		# Using \[ and \] around colors is necessary to prevent
 66+		# Using \001 and \002 around colors is necessary to prevent
 67 		# issues with command line editing/browsing/completion!
 68-		local c_red='\[\e[31m\]'
 69-		local c_green='\[\e[32m\]'
 70-		local c_lblue='\[\e[1;34m\]'
 71-		local c_clear='\[\e[0m\]'
 72+		local c_red=$'\001\e[31m\002'
 73+		local c_green=$'\001\e[32m\002'
 74+		local c_lblue=$'\001\e[1;34m\002'
 75+		local c_clear=$'\001\e[0m\002'
 76 	fi
 77 	local bad_color=$c_red
 78 	local ok_color=$c_green
 79@@ -508,6 +510,12 @@ __git_ps1 ()
 80 		r="$r $step/$total"
 81 	fi
 82 
 83+	local conflict="" # state indicator for unresolved conflicts
 84+	if [[ "${GIT_PS1_SHOWCONFLICTSTATE}" == "yes" ]] &&
 85+	   [[ $(git ls-files --unmerged 2>/dev/null) ]]; then
 86+		conflict="|CONFLICT"
 87+	fi
 88+
 89 	local w=""
 90 	local i=""
 91 	local s=""
 92@@ -564,15 +572,12 @@ __git_ps1 ()
 93 		b="\${__git_ps1_branch_name}"
 94 	fi
 95 
 96-	# NO color option unless in PROMPT_COMMAND mode or it's Zsh
 97 	if [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then
 98-		if [ $pcmode = yes ] || [ -n "${ZSH_VERSION-}" ]; then
 99-			__git_ps1_colorize_gitstring
100-		fi
101+		__git_ps1_colorize_gitstring
102 	fi
103 
104 	local f="$h$w$i$s$u$p"
105-	local gitstring="$c$b${f:+$z$f}${sparse}$r${upstream}"
106+	local gitstring="$c$b${f:+$z$f}${sparse}$r${upstream}${conflict}"
107 
108 	if [ $pcmode = yes ]; then
109 		if [ "${__git_printf_supports_v-}" != yes ]; then