mbox series

[v2,00/45] completion: git-completion 1.3.3 patches

Message ID 20210618182518.697912-1-felipe.contreras@gmail.com (mailing list archive)
Headers show
Series completion: git-completion 1.3.3 patches | expand

Message

Felipe Contreras June 18, 2021, 6:24 p.m. UTC
completion: git-completion 1.3.1 patches

These patches represent what comprises git-completion 1.3.1, a friendly
fork I'm maintaining.

Some of these have already been sent, and should be in "seen", but for
some reason they are not [1]. Others have been sent, but probably won't
receive any review soon.

Since the patches for git-completion 1.3.0 the only differece is a
rebase on top of v2.31.0.

Cheers.

[1] https://lore.kernel.org/git/5fea87e816fff_23821208d4@natae.notmuch/

Felipe Contreras (45):
  completion: fix __git_cmd_idx regression
  completion: bash: fix prefix detection in branch.*
  completion: fix for suboptions with value
  completion: bash: fix for multiple dash commands
  completion: bash: add correct suffix in variables
  completion: zsh: add higher-priority location
  completion: zsh: trivial improvement
  completion: bash: do not modify COMP_WORDBREAKS
  test: completion: fix currently typed words
  test: completion: switch __gitcomp_nl prefix test
  test: completion: add run_func() helper
  completion: bash: remove non-append functionality
  completion: bash: get rid of _append() functions
  completion: bash: get rid of any non-append code
  completion: zsh: fix options with arguments
  completion: zsh: expand --git-dir file argument
  completion: zsh: add support for general -C opts
  completion: zsh: fix for undefined completions
  completion: zsh: add support for general -c opts
  completion: zsh: fix extra space on foo=
  completion: zsh: add excluded options
  completion: zsh: always set compset
  completion: factor out check in __gitcomp
  completion: simplify equal suffix check
  completion: refactor __gitcomp
  completion: simplify __gitcomp
  completion: bash: change suffix check in __gitcomp
  completion: improve __gitcomp suffix code
  completion: bash: simplify config_variable_name
  test: completion: add missing test
  completion: bash: improve __gitcomp description
  completion: add __gitcomp_opts
  completion: bash: cleanup __gitcomp* invocations
  completion: bash: shuffle __gitcomp functions
  completion: zsh: simplify __gitcomp_direct
  completion: zsh: shuffle __gitcomp* functions
  completion: zsh: fix direct quoting
  completion: zsh: add elements individually in __gitcomp_opts
  completion: zsh: add __gitcompadd helper
  completion: zsh: add correct removable suffix
  completion: bash: simplify _get_comp_words_by_ref()
  completion: bash: refactor _get_comp_words_by_ref()
  completion: bash: cleanup _get_comp_words_by_ref()
  completion: bash: trivial cleanup
  completion: bash: rename _get_comp_words_by_ref()

 contrib/completion/git-completion.bash | 642 +++++++++++--------------
 contrib/completion/git-completion.zsh  | 141 +++---
 t/t9902-completion.sh                  | 159 +++---
 3 files changed, 435 insertions(+), 507 deletions(-)

Range-diff against v1:
 -:  ---------- >  1:  68e7376872 completion: fix __git_cmd_idx regression
 1:  f318584861 =  2:  f942d5884a completion: bash: fix prefix detection in branch.*
 2:  ce536d6e53 =  3:  c073c68d77 completion: fix for suboptions with value
 3:  50a4e412d3 =  4:  60596a5f3a completion: bash: fix for multiple dash commands
 4:  bf7dfb35d1 =  5:  40f67ea5fd completion: bash: add correct suffix in variables
43:  8f1399c468 =  6:  20c22f5337 completion: zsh: add higher-priority location
 -:  ---------- >  7:  120a675092 completion: zsh: trivial improvement
 5:  6338c510b4 =  8:  c58f5f8649 completion: bash: do not modify COMP_WORDBREAKS
 6:  ab79e84b26 =  9:  46bfd0d7ca test: completion: fix currently typed words
 7:  da3b5837df = 10:  4f44215d5e test: completion: switch __gitcomp_nl prefix test
 8:  1f2278ea0f ! 11:  99954f41d4 test: completion: add run_func() helper
    @@ t/t9902-completion.sh: test_path_completion ()
      	test_cmp expected out
      }
     @@ t/t9902-completion.sh: do
    - 		(
      			words=(git push '$flag' other ma) &&
      			cword=${#words[@]} cur=${words[cword-1]} &&
    + 			__git_cmd_idx=1 &&
     -			__git_complete_remote_or_refspec &&
     -			print_comp
     +			run_func __git_complete_remote_or_refspec
    @@ t/t9902-completion.sh: do
      		test_cmp expected out
      	'
     @@ t/t9902-completion.sh: do
    - 		(
      			words=(git push other '$flag' ma) &&
      			cword=${#words[@]} cur=${words[cword-1]} &&
    + 			__git_cmd_idx=1 &&
     -			__git_complete_remote_or_refspec &&
     -			print_comp
     +			run_func __git_complete_remote_or_refspec
 9:  106cbd3e72 = 12:  3e2ea37938 completion: bash: remove non-append functionality
10:  5145f47503 = 13:  d1162c8aa7 completion: bash: get rid of _append() functions
11:  1bf917c007 = 14:  ca88e56fa2 completion: bash: get rid of any non-append code
12:  ef1d6a3037 = 15:  54c3401eee completion: zsh: fix options with arguments
13:  b8d3bcb7a0 = 16:  3bca7df93a completion: zsh: expand --git-dir file argument
14:  89599ea5da ! 17:  2a3a5c3220 completion: zsh: add support for general -C opts
    @@ contrib/completion/git-completion.zsh: __git_zsh_main ()
      {
      	local curcontext="$curcontext" state state_descr line
      	typeset -A opt_args
    --	local -a orig_words
    -+	local -a orig_words __git_C_args
    - 
    - 	orig_words=( ${words[@]} )
    ++	local -a __git_C_args
      
    + 	_arguments -C \
    + 		'(-p --paginate --no-pager)'{-p,--paginate}'[pipe all output into ''less'']' \
     @@ contrib/completion/git-completion.zsh: __git_zsh_main ()
      		'--namespace=[set the git namespace]:' \
      		'--no-replace-objects[do not use replacement refs to replace git objects]' \
    @@ contrib/completion/git-completion.zsh: __git_zsh_main ()
     +
      		(( $+opt_args[--help] )) && command='help'
      
    - 		words=( ${orig_words[@]} )
    + 		words=( git ${words[@]} )
15:  ebc2bf8df1 = 18:  1bfe88f60c completion: zsh: fix for undefined completions
16:  4e2762f040 = 19:  ad75eccb20 completion: zsh: add support for general -c opts
17:  b856d42169 = 20:  d1587d19f7 completion: zsh: fix extra space on foo=
18:  d61682bc45 ! 21:  a18f9d962b completion: zsh: add excluded options
    @@ Commit message
     
      ## contrib/completion/git-completion.zsh ##
     @@ contrib/completion/git-completion.zsh: __git_zsh_main ()
    - 	orig_words=( ${words[@]} )
    + 	local -a __git_C_args
      
      	_arguments -C \
     -		'(-p --paginate --no-pager)'{-p,--paginate}'[pipe all output into ''less'']' \
19:  07819100c1 = 22:  c824921fa5 completion: zsh: always set compset
20:  391372ddf7 = 23:  daf7bc19bb completion: factor out check in __gitcomp
21:  1fd7477427 = 24:  41a9cd3e8d completion: simplify equal suffix check
22:  fc7bcb5122 = 25:  dd47842d0d completion: refactor __gitcomp
23:  85b5e719c7 = 26:  674a7ca73b completion: simplify __gitcomp
24:  30124bf50f = 27:  f3f77bb5a6 completion: bash: change suffix check in __gitcomp
25:  70653f57c0 = 28:  81e518f5a7 completion: improve __gitcomp suffix code
26:  ae6bab5e4f = 29:  9b3242d412 completion: bash: simplify config_variable_name
27:  f67cc99935 = 30:  869fafc5a7 test: completion: add missing test
28:  17bc28a487 = 31:  7b1b05352f completion: bash: improve __gitcomp description
29:  69f6533ef8 ! 32:  282221f9b6 completion: add __gitcomp_opts
    @@ contrib/completion/git-completion.bash: _git_sparse_checkout ()
      		;;
      	*)
      		;;
    -@@ contrib/completion/git-completion.bash: _git_stash ()
    - 	if [ -z "$subcommand" ]; then
    - 		case "$cur" in
    - 		--*)
    --			__gitcomp "$save_opts"
    -+			__gitcomp_opts "$save_opts"
    - 			;;
    - 		sa*)
    - 			if [ -z "$(__git_find_on_cmdline "$save_opts")" ]; then
    -@@ contrib/completion/git-completion.bash: _git_stash ()
    - 	else
    - 		case "$subcommand,$cur" in
    - 		push,--*)
    --			__gitcomp "$save_opts --message"
    -+			__gitcomp_opts "$save_opts --message"
    - 			;;
    - 		save,--*)
    --			__gitcomp "$save_opts"
    -+			__gitcomp_opts "$save_opts"
    - 			;;
    - 		apply,--*|pop,--*)
    --			__gitcomp "--index --quiet"
    -+			__gitcomp_opts "--index --quiet"
    - 			;;
    - 		drop,--*)
    --			__gitcomp "--quiet"
    -+			__gitcomp_opts "--quiet"
    - 			;;
    - 		list,--*)
    --			__gitcomp "--name-status --oneline --patch-with-stat"
    -+			__gitcomp_opts "--name-status --oneline --patch-with-stat"
    - 			;;
    - 		show,--*)
    --			__gitcomp "$__git_diff_common_options"
    -+			__gitcomp_opts "$__git_diff_common_options"
    - 			;;
    - 		branch,--*)
    - 			;;
     @@ contrib/completion/git-completion.bash: _git_submodule ()
      	if [ -z "$subcommand" ]; then
      		case "$cur" in
    @@ contrib/completion/git-completion.bash: _git_svn ()
      		*)
      			;;
     @@ contrib/completion/git-completion.bash: __git_main ()
    - 			;;
      		esac
      		case "$cur" in
    --		--*)   __gitcomp "
    -+		--*)   __gitcomp_opts "
    + 		--*)
    +-			__gitcomp "
    ++			__gitcomp_opts "
      			--paginate
      			--no-pager
      			--git-dir=
30:  a1a9dbb915 = 33:  2d00a52d65 completion: bash: cleanup __gitcomp* invocations
31:  9c17b3d3af = 34:  c34a4e0f93 completion: bash: shuffle __gitcomp functions
32:  37f2c72c9e = 35:  12de564dae completion: zsh: simplify __gitcomp_direct
33:  57ef037e81 = 36:  5c8aa847da completion: zsh: shuffle __gitcomp* functions
34:  ecb79bc877 = 37:  b2e1bb7a02 completion: zsh: fix direct quoting
35:  ae49a7c597 = 38:  43c3374fb2 completion: zsh: add elements individually in __gitcomp_opts
36:  135f68ca27 = 39:  a1f335b841 completion: zsh: add __gitcompadd helper
37:  e4f8591b72 = 40:  1416f590a7 completion: zsh: add correct removable suffix
38:  49217d4aa3 = 41:  081982e432 completion: bash: simplify _get_comp_words_by_ref()
39:  ef00c6e76e = 42:  2bd0507a7a completion: bash: refactor _get_comp_words_by_ref()
40:  993d5c83ae = 43:  188c8749cc completion: bash: cleanup _get_comp_words_by_ref()
41:  8b13e46fd3 = 44:  e08dc59d07 completion: bash: trivial cleanup
42:  658b5cccc8 ! 45:  893c8527d6 completion: bash: rename _get_comp_words_by_ref()
    @@ contrib/completion/git-completion.bash: if [[ -n ${ZSH_VERSION-} && -z ${GIT_SOU
     +
      __git_func_wrap ()
      {
    - 	local cur words cword prev
    + 	local cur words cword prev __git_cmd_idx=1
     -	_get_comp_words_by_ref -n =: cur words cword prev
     +	__git_get_comp_words_by_ref
      	$1