Further update the command line completion (in contrib/) for "git
stash".
* dl/complete-stash-updates:
git-completion.bash: consolidate cases in _git_stash()
git-completion.bash: use $__git_cmd_idx in more places
git-completion.bash: rename to $__git_cmd_idx
git-completion.bash: separate some commands onto their own line
@ -1898,6 +1900,7 @@ test_expect_success '__git_find_on_cmdline - no match' '
@@ -1898,6 +1900,7 @@ test_expect_success '__git_find_on_cmdline - no match' '
(
words=(git command --opt branch) &&
cword=${#words[@]} &&
__git_cmd_idx=1 &&
__git_find_on_cmdline "add list remove" >actual
) &&
test_must_be_empty actual
@ -1908,6 +1911,7 @@ test_expect_success '__git_find_on_cmdline - single match with index' '
@@ -1908,6 +1911,7 @@ test_expect_success '__git_find_on_cmdline - single match with index' '
(
words=(git command --opt list) &&
cword=${#words[@]} &&
__git_cmd_idx=1 &&
__git_find_on_cmdline --show-idx "add list remove" >actual
__git_find_on_cmdline --show-idx "add list remove" >actual
) &&
test_cmp expect actual
@ -1927,11 +1932,23 @@ test_expect_success '__git_find_on_cmdline - no match with index' '
@@ -1927,11 +1932,23 @@ test_expect_success '__git_find_on_cmdline - no match with index' '
(
words=(git command --opt branch) &&
cword=${#words[@]} &&
__git_cmd_idx=1 &&
__git_find_on_cmdline --show-idx "add list remove" >actual
) &&
test_must_be_empty actual
'
test_expect_success '__git_find_on_cmdline - ignores matches before command with index' '
echo "6 remove" >expect &&
(
words=(git -C remove command -o --opt remove list add) &&
cword=${#words[@]} &&
__git_cmd_idx=3 &&
__git_find_on_cmdline --show-idx "add list remove" >actual