Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
completion: factor out _git_xxx calling code
author
Nguyễn Thái Ngọc Duy
<pclouds@gmail.com>
Sat, 24 Mar 2018 20:35:21 +0000
(21:35 +0100)
committer
Junio C Hamano
<gitster@pobox.com>
Sun, 25 Mar 2018 16:33:45 +0000
(09:33 -0700)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/completion/git-completion.bash
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
d23bb38
)
diff --git
a/contrib/completion/git-completion.bash
b/contrib/completion/git-completion.bash
index d59b9bb4d8c0a028c5e4661227cd0d1bfbed8978..4aaec3cd40d767608ee170069b9fb6aecfd82f0c 100644
(file)
--- a/
contrib/completion/git-completion.bash
+++ b/
contrib/completion/git-completion.bash
@@
-3035,6
+3035,17
@@
_git_worktree ()
fi
}
fi
}
+__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
+ else
+ return 1
+ fi
+}
+
__git_main ()
{
local i c=1 command __git_dir __git_repo_path
__git_main ()
{
local i c=1 command __git_dir __git_repo_path
@@
-3094,14
+3105,12
@@
__git_main ()
return
fi
return
fi
- local completion_func="_git_${command//-/_}"
- declare -f $completion_func >/dev/null 2>/dev/null && $completion_func && return
+ __git_complete_command "$command" && return
local expansion=$(__git_aliased_command "$command")
if [ -n "$expansion" ]; then
words[1]=$expansion
local expansion=$(__git_aliased_command "$command")
if [ -n "$expansion" ]; then
words[1]=$expansion
- completion_func="_git_${expansion//-/_}"
- declare -f $completion_func >/dev/null 2>/dev/null && $completion_func
+ __git_complete_command "$expansion"
fi
}
fi
}