@matheusbsbs / matheus-bagliano / commits / a393777ec9
Fork 0

bash completion: refactor common log, shortlog and gitk options

Refactor options that are useful for more than one of them into a variable used by the relevant completions. This has the effect of adding the following options to git-log: --branches --tags --remotes --first-parent --dense --sparse --simplify-merges --simplify-by-decoration --first-parent --no-merges The following to git-shortlog: --branches --tags --remotes --first-parent And the following to gitk: --branches --tags --remotes --first-parent --no-merges --max-count= --max-age= --since= --after= --min-age= --until= --before= --dense --sparse --full-history --simplify-merges --simplify-by-decoration --left-right 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>

Thomas Rast committed Feb 16, 2009 at 17:34 UTC a393777ec9ca7c33cb76efa225ddacc53784c0dd
1 file changed +34 -15
contrib/completion/git-completion.bash
+34 -15
@@ -975,6 +975,27 @@ _git_ls_tree ()
975 __git_complete_file
976 }
977
978 +# Options that go well for log, shortlog and gitk
979 +__git_log_common_options="
980 + --not --all
981 + --branches --tags --remotes
982 + --first-parent --no-merges
983 + --max-count=
984 + --max-age= --since= --after=
985 + --min-age= --until= --before=
986 +"
987 +# Options that go well for log and gitk (not shortlog)
988 +__git_log_gitk_options="
989 + --dense --sparse --full-history
990 + --simplify-merges --simplify-by-decoration
991 + --left-right
992 +"
993 +# Options that go well for log and shortlog (not gitk)
994 +__git_log_shortlog_options="
995 + --author= --committer= --grep=
996 + --all-match
997 +"
998 +
999 __git_log_pretty_formats="oneline short medium full fuller email raw format:"
1000
1001 _git_log ()
@@ -996,21 +1017,19 @@ _git_log ()
1017 ;;
1018 --*)
1019 __gitcomp "
999 - --max-count= --max-age= --since= --after=
1000 - --min-age= --before= --until=
1020 + $__git_log_common_options
1021 + $__git_log_shortlog_options
1022 + $__git_log_gitk_options
1023 --root --topo-order --date-order --reverse
1002 - --no-merges --follow
1024 + --follow
1025 --abbrev-commit --abbrev=
1026 --relative-date --date=
1005 - --author= --committer= --grep=
1006 - --all-match
1027 --pretty=
1008 - --not --all
1009 - --left-right --cherry-pick
1028 + --cherry-pick
1029 --graph
1030 --decorate
1031 --walk-reflogs
1013 - --parents --children --full-history
1032 + --parents --children
1033 --merge
1034 $__git_diff_common_options
1035 --pickaxe-all --pickaxe-regex
@@ -1496,12 +1515,8 @@ _git_shortlog ()
1515 case "$cur" in
1516 --*)
1517 __gitcomp "
1499 - --max-count= --max-age= --since= --after=
1500 - --min-age= --before= --until=
1501 - --no-merges
1502 - --author= --committer= --grep=
1503 - --all-match
1504 - --not --all
1518 + $__git_log_common_options
1519 + $__git_log_shortlog_options
1520 --numbered --summary
1521 "
1522 return
@@ -1828,7 +1843,11 @@ _gitk ()
1843 fi
1844 case "$cur" in
1845 --*)
1831 - __gitcomp "--not --all $merge"
1846 + __gitcomp "
1847 + $__git_log_common_options
1848 + $__git_log_gitk_options
1849 + $merge
1850 + "
1851 return
1852 ;;
1853 esac