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>
This commit is contained in:
parent
81d3fe9f48
commit
a393777ec9
@ -975,6 +975,27 @@ _git_ls_tree ()
|
|||||||
__git_complete_file
|
__git_complete_file
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Options that go well for log, shortlog and gitk
|
||||||
|
__git_log_common_options="
|
||||||
|
--not --all
|
||||||
|
--branches --tags --remotes
|
||||||
|
--first-parent --no-merges
|
||||||
|
--max-count=
|
||||||
|
--max-age= --since= --after=
|
||||||
|
--min-age= --until= --before=
|
||||||
|
"
|
||||||
|
# Options that go well for log and gitk (not shortlog)
|
||||||
|
__git_log_gitk_options="
|
||||||
|
--dense --sparse --full-history
|
||||||
|
--simplify-merges --simplify-by-decoration
|
||||||
|
--left-right
|
||||||
|
"
|
||||||
|
# Options that go well for log and shortlog (not gitk)
|
||||||
|
__git_log_shortlog_options="
|
||||||
|
--author= --committer= --grep=
|
||||||
|
--all-match
|
||||||
|
"
|
||||||
|
|
||||||
__git_log_pretty_formats="oneline short medium full fuller email raw format:"
|
__git_log_pretty_formats="oneline short medium full fuller email raw format:"
|
||||||
|
|
||||||
_git_log ()
|
_git_log ()
|
||||||
@ -996,21 +1017,19 @@ _git_log ()
|
|||||||
;;
|
;;
|
||||||
--*)
|
--*)
|
||||||
__gitcomp "
|
__gitcomp "
|
||||||
--max-count= --max-age= --since= --after=
|
$__git_log_common_options
|
||||||
--min-age= --before= --until=
|
$__git_log_shortlog_options
|
||||||
|
$__git_log_gitk_options
|
||||||
--root --topo-order --date-order --reverse
|
--root --topo-order --date-order --reverse
|
||||||
--no-merges --follow
|
--follow
|
||||||
--abbrev-commit --abbrev=
|
--abbrev-commit --abbrev=
|
||||||
--relative-date --date=
|
--relative-date --date=
|
||||||
--author= --committer= --grep=
|
|
||||||
--all-match
|
|
||||||
--pretty=
|
--pretty=
|
||||||
--not --all
|
--cherry-pick
|
||||||
--left-right --cherry-pick
|
|
||||||
--graph
|
--graph
|
||||||
--decorate
|
--decorate
|
||||||
--walk-reflogs
|
--walk-reflogs
|
||||||
--parents --children --full-history
|
--parents --children
|
||||||
--merge
|
--merge
|
||||||
$__git_diff_common_options
|
$__git_diff_common_options
|
||||||
--pickaxe-all --pickaxe-regex
|
--pickaxe-all --pickaxe-regex
|
||||||
@ -1496,12 +1515,8 @@ _git_shortlog ()
|
|||||||
case "$cur" in
|
case "$cur" in
|
||||||
--*)
|
--*)
|
||||||
__gitcomp "
|
__gitcomp "
|
||||||
--max-count= --max-age= --since= --after=
|
$__git_log_common_options
|
||||||
--min-age= --before= --until=
|
$__git_log_shortlog_options
|
||||||
--no-merges
|
|
||||||
--author= --committer= --grep=
|
|
||||||
--all-match
|
|
||||||
--not --all
|
|
||||||
--numbered --summary
|
--numbered --summary
|
||||||
"
|
"
|
||||||
return
|
return
|
||||||
@ -1828,7 +1843,11 @@ _gitk ()
|
|||||||
fi
|
fi
|
||||||
case "$cur" in
|
case "$cur" in
|
||||||
--*)
|
--*)
|
||||||
__gitcomp "--not --all $merge"
|
__gitcomp "
|
||||||
|
$__git_log_common_options
|
||||||
|
$__git_log_gitk_options
|
||||||
|
$merge
|
||||||
|
"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
Loading…
x
Reference in New Issue
Block a user