From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH 3/4] completion: disable dwim on "git switch -d"
Date: Thu, 20 Jun 2019 16:55:22 +0700 [thread overview]
Message-ID: <20190620095523.10003-4-pclouds@gmail.com> (raw)
In-Reply-To: <20190620095523.10003-1-pclouds@gmail.com>
Even though dwim is enabled by default, it will never be done when
--detached is specified. If you force "-d --guess" you will get an error
because --guess then implies -c which cannot be used with -d. So we can
disable dwim in "switch -d". It makes the completion list in this case a
bit shorter.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
contrib/completion/git-completion.bash | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 58d18d41a2..656e49710e 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2183,6 +2183,10 @@ _git_switch ()
fi
if [ -z "$(__git_find_on_cmdline "-d --detach")" ]; then
only_local_ref=y
+ else
+ # --guess --detach is invalid combination, no
+ # dwim will be done when --detach is specified
+ track_opt=
fi
if [ $only_local_ref = y -a -z "$track_opt" ]; then
__gitcomp_direct "$(__git_heads "" "$cur" " ")"
--
2.22.0.rc0.322.g2b0371e29a
next prev parent reply other threads:[~2019-06-20 9:55 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-20 9:55 [PATCH 0/4] Some more on top of nd/switch-and-restore Nguyễn Thái Ngọc Duy
2019-06-20 9:55 ` [PATCH 1/4] t2027: use test_must_be_empty Nguyễn Thái Ngọc Duy
2019-06-20 9:55 ` [PATCH 2/4] switch: allow to switch in the middle of bisect Nguyễn Thái Ngọc Duy
2019-06-20 14:02 ` Derrick Stolee
2019-06-20 15:06 ` Duy Nguyen
2019-06-20 9:55 ` Nguyễn Thái Ngọc Duy [this message]
2019-06-20 9:55 ` [PATCH 4/4] restore: add --intent-to-add (restoring worktree only) Nguyễn Thái Ngọc Duy
2019-06-20 14:34 ` Derrick Stolee
2019-06-20 14:58 ` Duy Nguyen
2019-06-26 19:58 ` [PATCH 0/4] Some more on top of nd/switch-and-restore Junio C Hamano
2019-06-27 2:53 ` Duy Nguyen
2019-06-27 8:53 ` Duy Nguyen
2019-06-27 17:53 ` Junio C Hamano
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=20190620095523.10003-4-pclouds@gmail.com \
--to=pclouds@gmail.com \
--cc=git@vger.kernel.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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.