git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] completion: complete modified files for checkout with '--'
@ 2017-02-13 23:33 cornelius.weig
  2017-02-14  0:50 ` SZEDER Gábor
  0 siblings, 1 reply; 12+ messages in thread
From: cornelius.weig @ 2017-02-13 23:33 UTC (permalink / raw)
  To: git; +Cc: Cornelius Weig, szeder.dev, j6t, bitte.keine.werbung.einwerfen

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


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-02-15 22:45 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-13 23:33 [PATCH] completion: complete modified files for checkout with '--' cornelius.weig
2017-02-14  0:50 ` 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

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).