summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorSZEDER Gábor <szeder.dev@gmail.com>2017-03-23 15:38:39 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-03-23 20:31:24 (GMT)
commit41d2716cdc9179c5faa39d3fc05edf1e8bfd42cf (patch)
tree4de7b6bda02637bbfb7f0367c3e5360f49cde78d /contrib
parent2f779f91764cb79303d8166b0df7049045e232ac (diff)
downloadgit-41d2716cdc9179c5faa39d3fc05edf1e8bfd42cf.zip
git-41d2716cdc9179c5faa39d3fc05edf1e8bfd42cf.tar.gz
git-41d2716cdc9179c5faa39d3fc05edf1e8bfd42cf.tar.bz2
completion: offer ctags symbol names for 'git log -S', '-G' and '-L:'
Just like in the case of search patterns for 'git grep', see 29eec71f2 (completion: match ctags symbol names in grep patterns, 2011-10-21)), a common thing to look for using 'git log -S', '-G' and '-L:' is the name of a symbol. Teach the completion for 'git log' to offer ctags symbol names after these options, both in stuck and in unstuck forms. Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib')
-rw-r--r--contrib/completion/git-completion.bash28
1 files changed, 28 insertions, 0 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index a2b8603..d6f25a7 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1687,6 +1687,19 @@ _git_log ()
if [ -f "$__git_repo_path/MERGE_HEAD" ]; then
merge="--merge"
fi
+ case "$prev,$cur" in
+ -L,:*:*)
+ return # fall back to Bash filename completion
+ ;;
+ -L,:*)
+ __git_complete_symbol --cur="${cur#:}" --sfx=":"
+ return
+ ;;
+ -G,*|-S,*)
+ __git_complete_symbol
+ return
+ ;;
+ esac
case "$cur" in
--pretty=*|--format=*)
__gitcomp "$__git_log_pretty_formats $(__git_pretty_aliases)
@@ -1732,6 +1745,21 @@ _git_log ()
"
return
;;
+ -L:*:*)
+ return # fall back to Bash filename completion
+ ;;
+ -L:*)
+ __git_complete_symbol --cur="${cur#-L:}" --sfx=":"
+ return
+ ;;
+ -G*)
+ __git_complete_symbol --pfx="-G" --cur="${cur#-G}"
+ return
+ ;;
+ -S*)
+ __git_complete_symbol --pfx="-S" --cur="${cur#-S}"
+ return
+ ;;
esac
__git_complete_revlist
}