summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rw-r--r--contrib/completion/git-completion.bash28
1 files changed, 28 insertions, 0 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 4aaec3cd40..f65cb5d1f9 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -3035,12 +3035,40 @@ _git_worktree ()
fi
}
+__git_complete_common () {
+ local command="$1"
+
+ case "$cur" in
+ --*)
+ __gitcomp_builtin "$command"
+ ;;
+ esac
+}
+
+__git_cmds_with_parseopt_helper=
+__git_support_parseopt_helper () {
+ test -n "$__git_cmds_with_parseopt_helper" ||
+ __git_cmds_with_parseopt_helper="$(__git --list-parseopt-builtins)"
+
+ case " $__git_cmds_with_parseopt_helper " in
+ *" $1 "*)
+ return 0
+ ;;
+ *)
+ return 1
+ ;;
+ esac
+}
+
__git_complete_command () {
local command="$1"
local completion_func="_git_${command//-/_}"
if declare -f $completion_func >/dev/null 2>/dev/null; then
$completion_func
return 0
+ elif __git_support_parseopt_helper "$command"; then
+ __git_complete_common "$command"
+ return 0
else
return 1
fi