Skip to content

Commit d9ee1e0

Browse files
szedergitster
authored andcommitted
completion: simplify inner 'case' pattern in __gitcomp()
The second '*' in the '--*=*' pattern of the inner 'case' statement of the __gitcomp() helper function never matches anything, so let's use '--*=' instead. The purpose of that inner case statement is to decide when to append a trailing space to the listed options and when not. When an option requires a stuck argument, i.e. '--option=', then the trailing space should not be added, so the user can continue typing the required argument right away. That '--*=*' pattern is supposed to match these options, but for this purpose that second '*' is unnecessary, a '--*=' pattern works just as well. That second '*' would only make a difference in case of a possible completion word like '--option=value', but our completion script never passes such a word to __gitcomp(), because the '--option=' and its 'value' must be completed separately. Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 2675ea1 commit d9ee1e0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

contrib/completion/git-completion.bash

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ __gitcomp ()
340340
c="$c${4-}"
341341
if [[ $c == "$cur_"* ]]; then
342342
case $c in
343-
--*=*|*.) ;;
343+
--*=|*.) ;;
344344
*) c="$c " ;;
345345
esac
346346
COMPREPLY[i++]="${2-}$c"
@@ -360,7 +360,7 @@ __gitcomp ()
360360
c="$c${4-}"
361361
if [[ $c == "$cur_"* ]]; then
362362
case $c in
363-
--*=*|*.) ;;
363+
--*=|*.) ;;
364364
*) c="$c " ;;
365365
esac
366366
COMPREPLY[i++]="${2-}$c"

0 commit comments

Comments
 (0)