* [PATCH v2 4/8] completion: factor out _git_xxx calling code
2018-03-24 20:35 ` [PATCH v2 0/8] " Nguyễn Thái Ngọc Duy
@ 2018-03-24 20:35 ` Nguyễn Thái Ngọc Duy
0 siblings, 0 replies; 2+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24 20:35 UTC (permalink / raw)
To: pclouds; +Cc: git, szeder.dev, Junio C Hamano
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
contrib/completion/git-completion.bash | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 9bef457792..b3a9ecfad0 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -3034,6 +3034,17 @@ _git_worktree ()
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
@@ -3093,14 +3104,12 @@ __git_main ()
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
- completion_func="_git_${expansion//-/_}"
- declare -f $completion_func >/dev/null 2>/dev/null && $completion_func
+ __git_complete_command "$expansion"
fi
}
--
2.17.0.rc0.348.gd5a49e0b6f
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2 4/8] completion: factor out _git_xxx calling code
@ 2018-03-25 20:57 Recep Aslan
0 siblings, 0 replies; 2+ messages in thread
From: Recep Aslan @ 2018-03-25 20:57 UTC (permalink / raw)
To: pclouds; +Cc: git, gitster, szeder.dev
Sssss
iPhone’umdan gönderildi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-03-25 21:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-25 20:57 [PATCH v2 4/8] completion: factor out _git_xxx calling code Recep Aslan
-- strict thread matches above, loose matches on Subject: below --
2018-03-21 19:30 [PATCH] completion: add option completion for most builtin commands Nguyễn Thái Ngọc Duy
2018-03-24 20:35 ` [PATCH v2 0/8] " Nguyễn Thái Ngọc Duy
2018-03-24 20:35 ` [PATCH v2 4/8] completion: factor out _git_xxx calling code Nguyễn Thái Ngọc Duy
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).