Skip to content

pr-1108/ldennington/sparse-checkout-bash-completion-v3

This series is based on en/sparse-checkout-set. It updates custom tab
completion for the sparse-checkout command. Specifically, it corrects the
following issues with the current method:

 1. git sparse-checkout <TAB> results in an incomplete list of subcommands
    (it is missing reapply and add).
 2. git sparse-checkout --<TAB> does not complete the help option.
 3. Options for subcommands are not tab-completable.
 4. git sparse-checkout set <TAB> and git sparse-checkout add <TAB> show
    both file names and directory names.

The first commit in this series is a set of failing tests that highlight
each of the above issues. The next commit updates the _git_sparse_checkout
method in git-completion.bash to enable each of these tests to pass. The
final commit modifies the original implementation (which recursively printed
prospective directories for completion) to only print directories at the
current level for improved performance.

Changes since V2
================

 * Change use of $prev to $subcommand in _git_sparse_checkout() method in
   git-completion.bash.
 * State explicitly that directory completion applies in both cone and
   non-cone mode in 'sparse-checkout: custom tab completion' commit
 * Add new patch with __gitcomp_directories method to improve performance by
   only outputting directories at the current level.

Changes since V1
================

 * Rebase onto en/sparse-checkout-set.
 * Add subcommand options (including --no-cone) for set and reapply.
 * Extend 'sparse-checkout completes subcommand options' test to validate
   new set/reapply subcommand options.
 * No longer set index.sparse to false in 'sparse-checkout completes
   directory names' test.

Thanks, Lessley

Lessley Dennington (3):
  sparse-checkout: custom tab completion tests
  sparse-checkout: custom tab completion
  sparse-checkout: limit tab completion to a single level

 contrib/completion/git-completion.bash | 68 +++++++++++++++----
 t/t9902-completion.sh                  | 94 ++++++++++++++++++++++++++
 2 files changed, 150 insertions(+), 12 deletions(-)

base-commit: dfac9b609f86cd4f6ce896df9e1172d2a02cde48

Submitted-As: https://lore.kernel.org/git/pull.1108.v3.git.1641841193.gitgitgadget@gmail.com
In-Reply-To: https://lore.kernel.org/git/pull.1108.git.1640824351.gitgitgadget@gmail.com
In-Reply-To: https://lore.kernel.org/git/pull.1108.v2.git.1640892413.gitgitgadget@gmail.com
Assets 2