From: Thomas Rast Date: Mon, 12 Oct 2009 09:00:09 +0000 (+0200) Subject: bash completion: complete refs for git-grep X-Git-Tag: v1.6.6-rc0~132 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=17225c49d501a304a0ae9ff370ca5cc3ae4afe4d;p=git.git bash completion: complete refs for git-grep Before the --, always attempt ref completion. This helps with entering the arguments to git-grep. As a bonus, you can work around git-grep's current lack of --all by hitting M-*, ugly as the resulting command line may be. Strictly speaking, completing the regular expression argument (or option argument) makes no sense. However, we cannot prevent _all_ completion (it will fall back to filenames), so we dispense with any additional complication to detect whether the user still has to enter a regular expression. Signed-off-by: Thomas Rast Acked-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 7cf855746..d3fec3299 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1069,7 +1069,8 @@ _git_grep () return ;; esac - COMPREPLY=() + + __gitcomp "$(__git_refs)" } _git_help ()