Skip to content

Commit

Permalink
bash completion: complete refs for git-grep
Browse files Browse the repository at this point in the history
Before the --, always attempt ref completion.  This helps with
entering the <treeish> 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 <trast@student.ethz.ch>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Thomas Rast authored and Junio C Hamano committed Oct 12, 2009
1 parent 2775d92 commit 17225c4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion contrib/completion/git-completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,8 @@ _git_grep ()
return
;;
esac
COMPREPLY=()

__gitcomp "$(__git_refs)"
}

_git_help ()
Expand Down

0 comments on commit 17225c4

Please sign in to comment.