diff options
author | Daniel Hahler <git@thequod.de> | 2015-05-14 19:00:32 +0200 |
---|---|---|
committer | Oliver Kiddle <opk@zsh.org> | 2015-05-14 19:00:32 +0200 |
commit | a1c1f6828c4e708fe07868b9ec531ba4c4807cde (patch) | |
tree | a6000127f1272080308b5149d218c74c3546d7f4 /Completion/Unix | |
parent | fec4e7243b3ef960fb5c4fd6b0bb54f4da34f949 (diff) | |
download | zsh-a1c1f6828c4e708fe07868b9ec531ba4c4807cde.tar.gz zsh-a1c1f6828c4e708fe07868b9ec531ba4c4807cde.tar.xz zsh-a1c1f6828c4e708fe07868b9ec531ba4c4807cde.zip |
35061: add __git_setup_diff_stage_options and use it with _git-diff-files and _git-diff explicitly
Diffstat (limited to 'Completion/Unix')
-rw-r--r-- | Completion/Unix/Command/_git | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 5df01f706..631d2f798 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -714,12 +714,14 @@ _git-diff () { local curcontext=$curcontext state line ret=1 declare -A opt_args - local -a diff_options + local -a diff_options diff_stage_options __git_setup_diff_options + __git_setup_diff_stage_options _arguments -w -C -s \ $* \ $diff_options \ + $diff_stage_options \ '(--cached --staged)'{--cached,--staged}'[show diff between index and named commit]' \ '(-)--[start file arguments]' \ '*:: :->from-to-file' && ret=0 @@ -4341,11 +4343,13 @@ _git-cat-file () { (( $+functions[_git-diff-files] )) || _git-diff-files () { - declare -a revision_options + local -a revision_options diff_stage_options __git_setup_revision_options + __git_setup_diff_stage_options _arguments -w -S -s \ $revision_options \ + $diff_stage_options \ ': :__git_changed-in-working-tree_files' \ ': :__git_changed-in-working-tree_files' \ '*: :__git_changed-in-working-tree_files' @@ -6230,14 +6234,20 @@ __git_setup_diff_options () { '(--no-prefix)--dst-prefix=[use given prefix for destination]:prefix' '(--src-prefix --dst-prefix)--no-prefix[do not show any source or destination prefix]' + '(-c,--cc)'{-b,--cc}'[combined diff format for merge commits]' + + # TODO: --output is undocumented. + '--output[undocumented]:undocumented') +} + +(( $+functions[__git_setup_diff_stage_options] )) || +__git_setup_diff_stage_options () { + diff_stage_options=( '(-0 -1 -2 -3 --base --ours --theirs -c --cc --no-index)'{-1,--base}'[diff against "base" version]' '(-0 -1 -2 -3 --base --ours --theirs -c --cc --no-index)'{-2,--ours}'[diff against "our branch" version]' '(-0 -1 -2 -3 --base --ours --theirs -c --cc --no-index)'{-3,--theirs}'[diff against "their branch" version]' '(-0 -1 -2 -3 --base --ours --theirs -c --cc --no-index)-0[omit diff output for unmerged entries]' - '(-0 -1 -2 -3 --base --ours --theirs -c --cc --no-index)'{-c,--cc}'[compare "our branch", "their branch" and working tree files]' - - # TODO: --output is undocumented. - '--output[undocumented]:undocumented') + ) } (( $+functions[__git_setup_revision_options] )) || |