From: "SZEDER Gábor" <szeder@ira.uka.de>
To: Kevin Ballard <kevin@sb.org>
Cc: git@vger.kernel.org, Shawn Pearce <spearce@spearce.org>
Subject: Re: [PATCH] completion: Support the DWIM mode for git checkout
Date: Sun, 10 Oct 2010 23:16:34 +0200 [thread overview]
Message-ID: <20101010211634.GA4730@neumann> (raw)
In-Reply-To: <1286496492-65221-1-git-send-email-kevin@sb.org>
Hi,
On Thu, Oct 07, 2010 at 05:08:12PM -0700, Kevin Ballard wrote:
> Signed-off-by: Kevin Ballard <kevin@sb.org>
> ---
I think the commit message should add some details about how the patch
changes the completion script's behavior. At least I didn't know
offhand what "DWIM mode for git checkout" is, and once I found it
(70c9ac2 (DWIM "git checkout frotz" to "git checkout -b frotz
origin/frotz", 2009-10-18), right?), I didn't know how the completion
script is supposed to support that, and once I applied the patch and
played around a bit, I was surprised that only 'git checkout h<tab>'
includes the 'html' branch but 'git checkout <tab>' don't.
> contrib/completion/git-completion.bash | 35 +++++++++++++++++++++++++++++--
> 1 files changed, 32 insertions(+), 3 deletions(-)
>
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index f83f019..be0498c 100755
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -988,7 +1007,17 @@ _git_checkout ()
> "
> ;;
> *)
> - __gitcomp "$(__git_refs)"
> + # check if --track, --no-track, or --no-guess was specified
> + # if so, disable DWIM mode
> + local i c=1 track=1
> + while [ $c -lt $COMP_CWORD ]; do
> + i="${COMP_WORDS[c]}"
> + case "$i" in
> + --track|--no-track|--no-guess) track=''; break ;;
> + esac
> + c=$((++c))
> + done
> + __gitcomp "$(__git_refs '' $track)"
You could use the __git_find_on_cmdline() helper function instead.
Best,
Gábor
next prev parent reply other threads:[~2010-10-10 21:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-08 0:08 [PATCH] completion: Support the DWIM mode for git checkout Kevin Ballard
2010-10-10 21:16 ` SZEDER Gábor [this message]
2010-10-10 23:18 ` Kevin Ballard
2010-10-12 21:38 ` [PATCH v2] " Kevin Ballard
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=20101010211634.GA4730@neumann \
--to=szeder@ira.uka.de \
--cc=git@vger.kernel.org \
--cc=kevin@sb.org \
--cc=spearce@spearce.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 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).