From: m0viefreak <m0viefreak.cm@googlemail.com>
To: zsh-workers@zsh.org
Cc: m0viefreak <m0viefreak.cm@googlemail.com>
Subject: [PATCH 4/4] completion: _git: diff: add --no-index
Date: Sun, 13 Mar 2016 23:02:00 +0100 [thread overview]
Message-ID: <1457906520-2612-5-git-send-email-m0viefreak.cm@googlemail.com> (raw)
In-Reply-To: <1457906520-2612-1-git-send-email-m0viefreak.cm@googlemail.com>
---
Completion/Unix/Command/_git | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 023740e..c989a2c 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -725,12 +725,28 @@ _git-diff () {
$* \
$diff_options \
$diff_stage_options \
- '(--cached --staged)'{--cached,--staged}'[show diff between index and named commit]' \
+ '(--no-index --cached --staged)--no-index[diff files outside of git repo]' \
+ '(--no-index --cached --staged)'{--cached,--staged}'[show diff between index and named commit]' \
'(-)--[start file arguments]' \
'*:: :->from-to-file' && ret=0
case $state in
(from-to-file)
+ # If "--no-index" was given simply complete arbitrary files
+ if (( opt_args[(I)--no-index] )); then
+ local expl descr
+ if (( CURRENT == 1 )); then
+ descr="original file"
+ elif (( CURRENT == 2 )); then
+ descr="new file"
+ else
+ return ret
+ fi
+ _description all-files expl "$descr"
+ _files "$expl[@]"
+ return
+ fi
+
# If "--" is part of $opt_args, this means it was specified before any
# $words arguments. This means that no heads are specified in front, so
# we need to complete *changed* files only.
--
2.5.0.234.gefc8a62
prev parent reply other threads:[~2016-03-13 22:18 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-13 22:01 [PATCH 0/4] A few patches to _git m0viefreak
2016-03-13 22:01 ` [PATCH 1/4] _git: reflog: complete references next to commands m0viefreak
2016-03-15 0:08 ` Daniel Shahaf
2016-03-13 22:01 ` [PATCH 2/4] _git: fix tag name of remote branches m0viefreak
2016-03-15 0:08 ` Daniel Shahaf
2016-03-13 22:01 ` [PATCH 3/4] _git: log: ignore numeric options m0viefreak
2016-03-15 0:08 ` Daniel Shahaf
2016-03-16 20:43 ` m0viefreak
2016-03-16 22:39 ` Daniel Shahaf
2016-03-16 23:00 ` m0viefreak
2016-03-13 22:02 ` m0viefreak [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1457906520-2612-5-git-send-email-m0viefreak.cm@googlemail.com \
--to=m0viefreak.cm@googlemail.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).