git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: cornelius.weig@tngtech.com
To: git@vger.kernel.org
Cc: Cornelius Weig <cornelius.weig@tngtech.com>,
	szeder.dev@gmail.com, j6t@kdbg.org,
	bitte.keine.werbung.einwerfen@googlemail.com
Subject: [PATCH] completion: complete modified files for checkout with '--'
Date: Tue, 14 Feb 2017 00:33:59 +0100	[thread overview]
Message-ID: <20170213233359.11149-1-cornelius.weig@tngtech.com> (raw)

From: Cornelius Weig <cornelius.weig@tngtech.com>

The command line completion for git-checkout bails out when seeing '--'
as an isolated argument. For git-checkout this signifies the start of a
list of files which are to be checked out. Checkout of files makes only
sense for modified files, therefore completion can be a bit smarter:
Instead of bailing out, offer modified files for completion.

Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com>
---
 contrib/completion/git-completion.bash | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 6c6e1c7..d6523fd 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1059,7 +1059,10 @@ _git_bundle ()
 
 _git_checkout ()
 {
-	__git_has_doubledash && return
+	__git_has_doubledash && {
+		__git_complete_index_file "--modified"
+		return
+	}
 
 	case "$cur" in
 	--conflict=*)
-- 
2.10.2


             reply	other threads:[~2017-02-13 23:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-13 23:33 cornelius.weig [this message]
2017-02-14  0:50 ` [PATCH] completion: complete modified files for checkout with '--' SZEDER Gábor
2017-02-14 21:13   ` Cornelius Weig
2017-02-14 21:24     ` [PATCH v2 1/2] completion: extract utility to complete paths from tree-ish cornelius.weig
2017-02-14 21:24       ` [PATCH v2 2/2] completion: checkout: complete paths when ref given cornelius.weig
2017-02-14 21:31         ` Junio C Hamano
2017-02-14 22:13           ` Cornelius Weig
2017-02-14 22:45             ` Junio C Hamano
2017-02-15  3:11         ` SZEDER Gábor
2017-02-15 10:46           ` Cornelius Weig
2017-02-15 14:26         ` SZEDER Gábor
2017-02-15 22:45           ` Cornelius Weig

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=20170213233359.11149-1-cornelius.weig@tngtech.com \
    --to=cornelius.weig@tngtech.com \
    --cc=bitte.keine.werbung.einwerfen@googlemail.com \
    --cc=git@vger.kernel.org \
    --cc=j6t@kdbg.org \
    --cc=szeder.dev@gmail.com \
    /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 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).