bash completion: refactor diff options
diff, log and show all take the same diff options. Refactor them from __git_diff and __git_log into a variable, and complete them in __git_show too. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
47d5a8fa71
commit
20bf729231
@ -773,14 +773,7 @@ _git_describe ()
|
|||||||
__gitcomp "$(__git_refs)"
|
__gitcomp "$(__git_refs)"
|
||||||
}
|
}
|
||||||
|
|
||||||
_git_diff ()
|
__git_diff_common_options="--stat --numstat --shortstat --summary
|
||||||
{
|
|
||||||
__git_has_doubledash && return
|
|
||||||
|
|
||||||
local cur="${COMP_WORDS[COMP_CWORD]}"
|
|
||||||
case "$cur" in
|
|
||||||
--*)
|
|
||||||
__gitcomp "--cached --stat --numstat --shortstat --summary
|
|
||||||
--patch-with-stat --name-only --name-status --color
|
--patch-with-stat --name-only --name-status --color
|
||||||
--no-color --color-words --no-renames --check
|
--no-color --color-words --no-renames --check
|
||||||
--full-index --binary --abbrev --diff-filter=
|
--full-index --binary --abbrev --diff-filter=
|
||||||
@ -789,8 +782,20 @@ _git_diff ()
|
|||||||
--ignore-all-space --exit-code --quiet --ext-diff
|
--ignore-all-space --exit-code --quiet --ext-diff
|
||||||
--no-ext-diff
|
--no-ext-diff
|
||||||
--no-prefix --src-prefix= --dst-prefix=
|
--no-prefix --src-prefix= --dst-prefix=
|
||||||
--base --ours --theirs
|
|
||||||
--inter-hunk-context=
|
--inter-hunk-context=
|
||||||
|
--raw
|
||||||
|
"
|
||||||
|
|
||||||
|
_git_diff ()
|
||||||
|
{
|
||||||
|
__git_has_doubledash && return
|
||||||
|
|
||||||
|
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
|
case "$cur" in
|
||||||
|
--*)
|
||||||
|
__gitcomp "--cached --pickaxe-all --pickaxe-regex
|
||||||
|
--base --ours --theirs
|
||||||
|
$__git_diff_common_options
|
||||||
"
|
"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
@ -976,16 +981,15 @@ _git_log ()
|
|||||||
--relative-date --date=
|
--relative-date --date=
|
||||||
--author= --committer= --grep=
|
--author= --committer= --grep=
|
||||||
--all-match
|
--all-match
|
||||||
--pretty= --name-status --name-only --raw
|
--pretty=
|
||||||
--not --all
|
--not --all
|
||||||
--left-right --cherry-pick
|
--left-right --cherry-pick
|
||||||
--graph
|
--graph
|
||||||
--stat --numstat --shortstat
|
--decorate
|
||||||
--decorate --diff-filter=
|
--walk-reflogs
|
||||||
--color-words --walk-reflogs
|
|
||||||
--parents --children --full-history
|
--parents --children --full-history
|
||||||
--merge
|
--merge
|
||||||
--inter-hunk-context=
|
$__git_diff_common_options
|
||||||
--pickaxe-all --pickaxe-regex
|
--pickaxe-all --pickaxe-regex
|
||||||
"
|
"
|
||||||
return
|
return
|
||||||
@ -1490,7 +1494,9 @@ _git_show ()
|
|||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
--*)
|
--*)
|
||||||
__gitcomp "--pretty="
|
__gitcomp "--pretty=
|
||||||
|
$__git_diff_common_options
|
||||||
|
"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
Loading…
Reference in New Issue
Block a user