git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
	Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: [PATCH 1/1] completion: complete <rev> in `git worktree add <path> <rev>`
Date: Mon, 10 Dec 2018 07:10:46 -0800 (PST)	[thread overview]
Message-ID: <830191fbfbf95b9d568ba91ddcdd9860173a476a.1544454643.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.82.git.gitgitgadget@gmail.com>

From: Johannes Schindelin <johannes.schindelin@gmx.de>

The second non-option argument to `git worktree`'s `add` command is an
optional revision. Let's complete it.

Inspired by https://github.com/git-for-windows/git/pull/1681.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 contrib/completion/git-completion.bash | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 9e8ec95c3c..4194b4a2e7 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2773,6 +2773,11 @@ _git_worktree ()
 		add,--*)
 			__gitcomp_builtin worktree_add
 			;;
+		add,*)
+			if [ $(__git_count_arguments "worktree") -eq 2 ]; then
+				__git_complete_refs
+			fi
+			;;
 		list,--*)
 			__gitcomp_builtin worktree_list
 			;;
-- 
gitgitgadget

  reply	other threads:[~2018-12-10 15:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-10 15:10 [PATCH 0/1] worktree: add completion for the rev argument in git worktree add <path> <rev> Johannes Schindelin via GitGitGadget
2018-12-10 15:10 ` Johannes Schindelin via GitGitGadget [this message]
2018-12-11  2:34   ` [PATCH 1/1] completion: complete <rev> in `git worktree add <path> <rev>` SZEDER Gábor

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=830191fbfbf95b9d568ba91ddcdd9860173a476a.1544454643.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johannes.schindelin@gmx.de \
    /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://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).