[PATCH v2 0/5] completion: improvements for git-bisect

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Bring completion for bisect up to date with current features.

I didn't hear back on my previous RFC Patch for these improvements, and
ultimately decided that simply aborting special completion efforts and
doing nothing on precondition violation is the best policy, because devs
will likely notice and users won't be irritated more than necessary.

Besides that the series has just been cleaned up a tiny bit.

Britton Leo Kerin (5):
  completion: complete new old actions, start opts
  completion: git-log opts to bisect visualize
  completion: move to maintain define-before-use
  completion: custom git-bisect terms
  completion: custom git-bisect terms

 contrib/completion/git-completion.bash | 312 +++++++++++++++----------
 1 file changed, 183 insertions(+), 129 deletions(-)

Range-diff against v1:
1:  e16264bfb9 = 1:  e16264bfb9 completion: complete new old actions, start opts
2:  90466cdfa5 ! 2:  130abe3460 completion: git-log opts to bisect visualize
    @@ Commit message
         accepts git-log options but not rev arguments (they are fixed to the
         commits under bisection).

    +    __git_complete_log_opts has a precondition that COMPREPLY be empty.  In
    +    a completion context it doesn't seem advisable to implement
    +    preconditions as noisy or hard failures, so instead it becomes a no-op
    +    on violation.  This should be detectable and quick to debug for devels,
    +    without ever aggravating a user (besides completion failure).
    +
         Signed-off-by: Britton Leo Kerin <britton.kerin@xxxxxxxxx>

      ## contrib/completion/git-completion.bash ##
    @@ contrib/completion/git-completion.bash: __git_diff_merges_opts="off none on firs
      __git_log_date_formats="relative iso8601 iso8601-strict rfc2822 short local default human raw unix auto: format:"

     -_git_log ()
    --{
    ++
    ++# Check for only porcelain (i.e. not git-rev-list) option (not argument)
    ++# and selected option argument completions for git-log options and if any
    ++# are found put them in COMPREPLY.  COMPREPLY must be empty at the start,
    ++# and will be empty on return if no candidates are found.
    ++__git_complete_log_opts ()
    + {
     -	__git_has_doubledash && return
     -	__git_find_repo_path
    ++	[ -z "$COMPREPLY" ] || return 1   # Precondition

    -+# Find only porcelain (i.e. not git-rev-list) option (not argument) and
    -+# selected option argument completions for git-log options and put them in
    -+# COMPREPLY.
    -+__git_complete_log_opts ()
    -+{
      	local merge=""
      	if [ -f "$__git_repo_path/MERGE_HEAD" ]; then
    - 		merge="--merge"
     @@ contrib/completion/git-completion.bash: _git_log ()
      		return
      		;;
      	esac
    -+
     +}
     +
     +_git_log ()
3:  0edfb54dd5 ! 3:  d659ace9c2 completion: move to maintain define-before-use
    @@ contrib/completion/git-completion.bash: _git_archive ()
     +__git_log_pretty_formats="oneline short medium full fuller reference email raw format: tformat: mboxrd"
     +__git_log_date_formats="relative iso8601 iso8601-strict rfc2822 short local default human raw unix auto: format:"
     +
    -+# Find only porcelain (i.e. not git-rev-list) option (not argument) and
    -+# selected option argument completions for git-log options and put them in
    -+# COMPREPLY.
    ++# Check for only porcelain (i.e. not git-rev-list) option (not argument)
    ++# and selected option argument completions for git-log options and if any
    ++# are found put them in COMPREPLY.  COMPREPLY must be empty at the start,
    ++# and will be empty on return if no candidates are found.
     +__git_complete_log_opts ()
     +{
    ++	[ -z "$COMPREPLY" ] || return 1   # Precondition
    ++
     +	local merge=""
     +	if [ -f "$__git_repo_path/MERGE_HEAD" ]; then
     +		merge="--merge"
    @@ contrib/completion/git-completion.bash: _git_archive ()
     +		return
     +		;;
     +	esac
    -+
     +}
     +
      _git_bisect ()
    @@ contrib/completion/git-completion.bash: _git_ls_tree ()
     -__git_log_date_formats="relative iso8601 iso8601-strict rfc2822 short local default human raw unix auto: format:"
     -
     -
    --# Find only porcelain (i.e. not git-rev-list) option (not argument) and
    --# selected option argument completions for git-log options and put them in
    --# COMPREPLY.
    +-# Check for only porcelain (i.e. not git-rev-list) option (not argument)
    +-# and selected option argument completions for git-log options and if any
    +-# are found put them in COMPREPLY.  COMPREPLY must be empty at the start,
    +-# and will be empty on return if no candidates are found.
     -__git_complete_log_opts ()
     -{
    +-	[ -z "$COMPREPLY" ] || return 1   # Precondition
    +-
     -	local merge=""
     -	if [ -f "$__git_repo_path/MERGE_HEAD" ]; then
     -		merge="--merge"
    @@ contrib/completion/git-completion.bash: _git_ls_tree ()
     -		return
     -		;;
     -	esac
    --
     -}
     -
      _git_log ()
4:  a8a730ffbe = 4:  c5bee633b2 completion: custom git-bisect terms
5:  44d3a36e20 ! 5:  220650f0ba completion: recognize but do not complete 'view'
    @@ Metadata
     Author: Britton Leo Kerin <britton.kerin@xxxxxxxxx>

      ## Commit message ##
    -    completion: recognize but do not complete 'view'
    -
    -    Completing it might annoy some existing users by creating completion
    -    ambiguity on 'v' and 'vi' without adding anything useful in terms of
    -    interface discovery/recall (because 'view' is just an alias anyway).
    +    completion: custom git-bisect terms

         Signed-off-by: Britton Leo Kerin <britton.kerin@xxxxxxxxx>

    @@ contrib/completion/git-completion.bash: _git_bisect ()
      	fi

     -	local subcommands="start bad new $term_bad good old $term_good terms skip reset visualize replay log run help"
    ++	# We will complete any custom terms, but still always complete the
    ++	# more usual bad/new/good/old because git bisect gives a good error
    ++	# message if these are given when not in use and that's better than
    ++	# silent refusal to complete if the user is confused.
    ++	#
     +	# We want to recognize 'view' but not complete it, because it overlaps
     +	# with 'visualize' too much and is just an alias for it.
    ++	#
     +	local completable_subcommands="start bad new $term_bad good old $term_good terms skip reset visualize replay log run help"
     +	local all_subcommands="$completable_subcommands view"

6:  7b88549fbe < -:  ---------- completion: add comment
--
2.43.0






[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux