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>
SZEDER Gábor committed
Mar 23, 2017 at 16:38 UTC
41d2716cdc9179c5faa39d3fc05edf1e8bfd42cf
1 file changed
+28
contrib/completion/git-completion.bash
+28
@@ -1687,6 +1687,19 @@ _git_log ()
1687
if [ -f "$__git_repo_path/MERGE_HEAD" ]; then
1688
merge="--merge"
1689
fi
1690
+ case "$prev,$cur" in
1691
+ -L,:*:*)
1692
+ return # fall back to Bash filename completion
1693
+ ;;
1694
+ -L,:*)
1695
+ __git_complete_symbol --cur="${cur#:}" --sfx=":"
1696
+ return
1697
+ ;;
1698
+ -G,*|-S,*)
1699
+ __git_complete_symbol
1700
+ return
1701
+ ;;
1702
+ esac
1703
case "$cur" in
1704
--pretty=*|--format=*)
1705
__gitcomp "$__git_log_pretty_formats $(__git_pretty_aliases)
@@ -1732,6 +1745,21 @@ _git_log ()
1745
"
1746
return
1747
;;
1748
+ -L:*:*)
1749
+ return # fall back to Bash filename completion
1750
+ ;;
1751
+ -L:*)
1752
+ __git_complete_symbol --cur="${cur#-L:}" --sfx=":"
1753
+ return
1754
+ ;;
1755
+ -G*)
1756
+ __git_complete_symbol --pfx="-G" --cur="${cur#-G}"
1757
+ return
1758
+ ;;
1759
+ -S*)
1760
+ __git_complete_symbol --pfx="-S" --cur="${cur#-S}"
1761
+ return
1762
+ ;;
1763
esac
1764
__git_complete_revlist
1765
}