Skip to content

Commit 276b49f

Browse files
pcloudsgitster
authored andcommitted
completion: fix __gitcomp_builtin no longer consider extra options
__gitcomp_builtin() has the main completion list provided by git xxx --git-completion-helper but the caller can also add extra options that is not provided by --git-completion-helper. The only call site that does this is "git difftool" completion. This support is broken by b221b5a (completion: collapse extra --no-.. options - 2018-06-06), which adds a special value "--" to mark that the rest of the options can be hidden by default. The commit forgets the fact that extra options are appended after "$(git xxx --git-completion-helper)", i.e. after this "--", and will be incorrectly hidden as well. Prepend the extra options before "$(git xxx --git-completion-helper)" to avoid this. Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b221b5a commit 276b49f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

contrib/completion/git-completion.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ __gitcomp_builtin ()
336336
if [ -z "$options" ]; then
337337
# leading and trailing spaces are significant to make
338338
# option removal work correctly.
339-
options=" $(__git ${cmd/_/ } --git-completion-helper) $incl "
339+
options=" $incl $(__git ${cmd/_/ } --git-completion-helper) "
340340
for i in $excl; do
341341
options="${options/ $i / }"
342342
done

0 commit comments

Comments
 (0)