git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: "SZEDER Gábor" <szeder@ira.uka.de>
Cc: Peter van der Does <peter@avirtualhome.com>,
	"Shawn O. Pearce" <spearce@spearce.org>,
	git@vger.kernel.org, Marc Branchaud <marcnarc@xiplink.com>,
	Brian Gernhardt <brian@gernhardtsoftware.com>,
	Kevin Ballard <kevin@sb.org>,
	Mathias Lafeldt <misfire@debugon.org>
Subject: Re: [RFC/PATCH 2/1] bash: eliminate dependency on bash_completion lib
Date: Thu, 2 Dec 2010 18:07:23 -0600	[thread overview]
Message-ID: <20101203000723.GB8438@burratino> (raw)
In-Reply-To: <20101202234053.GB3577@neumann>

SZEDER Gábor wrote:

> Bash's programmable completion provides the COMP_WORDS array variable,
> which holds the individual words in the current command line.  In Bash
> versions prior to v4 "words are split on shell metacharacters as the
> shell parser would separate them" (quote from bash v3.2.48's man
> page).  This behavior has changed with Bash v4, and the command line
> "is split into words as readline would split it, using COMP_WORDBREAKS
> as" "the set of characters that the readline library treats as word
> separators" (quote from bash v4's man page).
>
> Since COMP_WORDBREAKS contains the characters : and = by default, this
> behavior change in Bash also affects git's completion script.  For
> example, when using Bash v4 the completion script can't provide
> possible options for a command line argument (e.g. git log
> --pretty=<TAB><TAB> lists files, but it should list possible log
> formats).
> 
> 
> I would really, _really_ like to have the above text in the commit
> message (either in yours or in Peter's), because it took me weeks to
> figure this out ;)

Sounds good.

> (I'm still wondering what Bash v3.x was doing with COMP_WORDBREAKS,
> though...)

Based on v1.5.6.4~9^2 (bash completion: Resolve git show ref:path<tab>
losing ref: portion, 2008-07-15) it seems COMP_WORDBREAKS determined
the interpretation of COMPREPLY (result of completion).  Of course it
also governed standard filename completion.

> On Thu, Dec 02, 2010 at 03:02:07PM -0600, Jonathan Nieder wrote:

>> +++ b/contrib/completion/git-completion.bash
>> @@ -327,7 +327,102 @@ __gitcomp_1 ()
[...]
>> +# This function can be used to access a tokenized list of words
>> +# on the command line:
>> +#
>> +#	__reassemble_comp_words_by_ref '=:'
>
> __git_reassemble_comp_words_by_ref?
[...]
>>  if ! type _get_comp_words_by_ref >/dev/null 2>&1; then
>> +if [[ -n $ZSH_VERSION ]]; then
>
> This should be ${ZSH_VERSION-} to keep 'set -u' environments happy.

Nice catches; thanks.

  reply	other threads:[~2010-12-03  0:08 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-01 20:49 [PATCH v4 0/2] *** SUBJECT HERE *** Peter van der Does
2010-12-01 20:49 ` [PATCH v4 1/2] Introduce functions from bash-completion project Peter van der Does
2010-12-01 20:49 ` [PATCH v4 2/2] Use the new functions to get the current cword Peter van der Does
2010-12-02  7:45   ` Jonathan Nieder
2010-12-02 22:36   ` SZEDER Gábor
2010-12-01 21:09 ` [PATCH v4 0/2] Make git-completion Bash 4 compatible Jonathan Nieder
2010-12-02  1:10 ` SZEDER Gábor
2010-12-02  9:16 ` Jonathan Nieder
2010-12-02 14:16   ` Peter van der Does
2010-12-02 21:02     ` [RFC/PATCH 2/1] bash: eliminate dependency on bash_completion lib Jonathan Nieder
2010-12-02 23:40       ` SZEDER Gábor
2010-12-03  0:07         ` Jonathan Nieder [this message]
2010-12-03  8:02         ` Stephen Boyd
2010-12-07 16:07       ` SZEDER Gábor
2010-12-07 19:49         ` Jonathan Nieder
2010-12-07 20:41           ` SZEDER Gábor
2010-12-07 20:59             ` Jonathan Nieder
2010-12-07 21:03           ` Junio C Hamano
2010-12-15  6:24             ` [PATCH v5.1 0/3] Make git-completion Bash 4 compatible Jonathan Nieder
2010-12-15  6:26               ` [PATCH 1/3] bash: get --pretty=m<tab> completion to work with bash v4 Jonathan Nieder
2010-12-15  6:27               ` [PATCH 2/3] bash: simple reimplementation of _get_comp_words_by_ref Jonathan Nieder
2010-12-15  6:42               ` [MERGE PATCH 3/3] Merge branch 'master' (early part) into pd/bash-4-completion Jonathan Nieder

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=20101203000723.GB8438@burratino \
    --to=jrnieder@gmail.com \
    --cc=brian@gernhardtsoftware.com \
    --cc=git@vger.kernel.org \
    --cc=kevin@sb.org \
    --cc=marcnarc@xiplink.com \
    --cc=misfire@debugon.org \
    --cc=peter@avirtualhome.com \
    --cc=spearce@spearce.org \
    --cc=szeder@ira.uka.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).