From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24069 invoked by alias); 8 May 2015 14:46:53 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 35061 Received: (qmail 15582 invoked from network); 8 May 2015 14:46:52 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,UNPARSEABLE_RELAY autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=thequod.de; h= references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received:received; s=postfix2; t= 1431096410; bh=ktx/khEnBie9IQz9T56nsml4xw2YFid0CIyTOwer7mA=; b=Z NK23NgKbWkSRrovwXzJjhVFu5LN95f+nXU3iqpWn5pNMCkmEEtdjVz1SmPI3BviK q3Venr69rJTEQ8GHmrGUD1OLinXFRTi9ea1zmKj5/vwgPiTfYRhE1QZMxIPEuG0J Mz4FWNa1T8vfIAotEEcbydcHaVgMbu0ssIkD0rXBmM= From: Daniel Hahler To: zsh-workers@zsh.org Subject: [PATCH 1/2] completion: git: split diff options for stages (--theirs, --ours etc) Date: Fri, 8 May 2015 16:46:44 +0200 Message-Id: <1431096405-16016-1-git-send-email-genml+zsh-workers@thequod.de> X-Mailer: git-send-email 2.4.0.dirty In-Reply-To: References: From: Daniel Hahler This adds __git_setup_diff_stage_options and uses it with _git-diff-files and _git-diff explicitly, removing it from the common diff options. For example, 'git show' should not complete '--theirs'. --- Completion/Unix/Command/_git | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 979e3e7..c9074ca 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' @@ -6214,14 +6218,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] )) || -- 2.4.0.dirty