git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Peter van der Does <peter@avirtualhome.com>
Cc: "Shawn O. Pearce" <spearce@spearce.org>,
	git@vger.kernel.org, "SZEDER Gábor" <szeder@ira.uka.de>,
	"Marc Branchaud" <marcnarc@xiplink.com>,
	"Brian Gernhardt" <brian@gernhardtsoftware.com>,
	"Kevin Ballard" <kevin@sb.org>,
	"Mathias Lafeldt" <misfire@debugon.org>
Subject: Re: [PATCH v2/RFC] Make git-completion Bash 4 compatible.
Date: Wed, 27 Oct 2010 12:31:32 -0500	[thread overview]
Message-ID: <20101027173132.GA15657@burratino> (raw)
In-Reply-To: <20101027131506.4da06c6d@MonteCarlo>

Hi Peter,

Peter van der Does wrote:

> The completion script does not work as expected under Bash 4.

Thanks for your work fixing this.  That's awesome.

It would be ideal if someone could write or find a nice summary of the
problem and the chosen solution, for inclusion in the commit message.

Could some zsh user perhaps test that the new zsh support is not
broken?

>  1 files changed, 355 insertions(+), 62 deletions(-)

Kind of unfortunate.  There are a lot of comments, but still...

> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -76,12 +76,251 @@
>  #
>  #       git@vger.kernel.org
>  #
> +# Updated for Bash 4.0

I don't think this comment will be so important for posterity (e.g., once
bash 5 comes around ;-)).

[...]
> +# If the function _get_comp_words_by_ref does not exists, we can assume the
> +# bash_completion 1.2 script isn't loaded and therefor we're defining the
> +# necessary functions ourselves.

Probably this explanation belongs in the commit message?  A comment
could provide a brief reminder, like:

	if ! type _get_comp_words_by_ref &>/dev/null ; then
		# The bash_completion 1.2 library was not loaded,
		# so we have to define some functions from it ourselves.

Are the implementations taken from bash_completion?  If so, that would
be very useful information for the log message: future readers may
want to know where to look for a more recent version.

> +	# Assign variable one scope above the caller
[... I'm assuming this is all written correctly, etc ...]

> @@ -331,7 +570,8 @@ __gitcomp_1 ()
>  # generates completion reply with compgen
>  __gitcomp ()
>  {
> -	local cur="${COMP_WORDS[COMP_CWORD]}"
> +	local cur
> +	_get_comp_words_by_ref -n "=" cur
[...]

The rest looks sane.  Maybe it would make sense to split this into two
patches for readability:

 - one to introduce the _get_comp_words_by_ref function
 - one to use it

?

  parent reply	other threads:[~2010-10-27 17:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-27 17:15 [PATCH v2/RFC] Make git-completion Bash 4 compatible Peter van der Does
2010-10-27 17:23 ` Brian Gernhardt
2010-10-27 17:31 ` Jonathan Nieder [this message]
2010-10-27 22:53   ` SZEDER Gábor
2010-10-28  0:52     ` Peter van der Does
2010-10-28  0:54       ` Jonathan Nieder
2010-10-28 12:14         ` Peter van der Does
2010-10-28 16:15           ` Jakub Narebski
2010-10-28 18:46             ` Peter van der Does
2010-10-27 22:39 ` SZEDER Gábor
2010-10-28  0:48   ` 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

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

  git send-email \
    --in-reply-to=20101027173132.GA15657@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.
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).