Skip to content

Commit 17225c4

Browse files
trastgitster
authored andcommitted
bash completion: complete refs for git-grep
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 <[email protected]> Acked-by: Shawn O. Pearce <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2775d92 commit 17225c4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

contrib/completion/git-completion.bash

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,8 @@ _git_grep ()
10691069
return
10701070
;;
10711071
esac
1072-
COMPREPLY=()
1072+
1073+
__gitcomp "$(__git_refs)"
10731074
}
10741075

10751076
_git_help ()

0 commit comments

Comments
 (0)