From: "SZEDER Gábor" <szeder@ira.uka.de>
To: Peter van der Does <peter@avirtualhome.com>
Cc: "Shawn O. Pearce" <spearce@spearce.org>,
git@vger.kernel.org, Jonathan Nieder <jrnieder@gmail.com>
Subject: Re: [PATCH v4 2/2] Use the new functions to get the current cword.
Date: Thu, 2 Dec 2010 23:36:01 +0100 [thread overview]
Message-ID: <20101202223601.GA3577@neumann> (raw)
In-Reply-To: <1291236582-28603-3-git-send-email-peter@avirtualhome.com>
Hi,
Here are my nits I mentioned yesterday.
On Wed, Dec 01, 2010 at 03:49:42PM -0500, Peter van der Does wrote:
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 0036e8b..f915e1f 100755
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -1064,9 +1073,10 @@ __git_find_on_cmdline ()
>
> __git_has_doubledash ()
> {
> - local c=1
> - while [ $c -lt $COMP_CWORD ]; do
> - if [ "--" = "${COMP_WORDS[c]}" ]; then
> + local c=1, words cword
No comma, and ...
> + _get_comp_words_by_ref words cword
> + while [ $c -lt $cwords ]; do
... that should be $cword in the condition, without the s at the end.
These two typos caused some weird behaviors when completing long
options for commands understanding the '--' option-path separator,
e.g. git diff --<TAB<TAB>.
> @@ -1775,7 +1814,7 @@ _git_notes ()
> prune,*)
> ;;
> *)
> - case "${COMP_WORDS[COMP_CWORD-1]}" in
> + case "${prev}" in
> @@ -2615,7 +2670,7 @@ _git_tag ()
> c=$((++c))
> done
>
> - case "${COMP_WORDS[COMP_CWORD-1]}" in
> + case "${prev}" in
No {} are needed around prev.
> @@ -2639,15 +2694,16 @@ _git_whatchanged ()
>
> _git ()
> {
> - local i c=1 command __git_dir
> + local i c=1 command __git_dir words cword
>
> - if [[ -n ${ZSH_VERSION-} ]]; then
> + if [[ -n $ZSH_VERSION ]]; then
> @@ -2690,19 +2746,20 @@ _git ()
>
> _gitk ()
> {
> - if [[ -n ${ZSH_VERSION-} ]]; then
> + if [[ -n $ZSH_VERSION ]]; then
> @@ -2730,7 +2787,7 @@ complete -o bashdefault -o default -o nospace -F _git git.exe 2>/dev/null \
> || complete -o default -o nospace -F _git git.exe
> fi
>
> -if [[ -n ${ZSH_VERSION-} ]]; then
> +if [[ -n $ZSH_VERSION ]]; then
These three changes have nothing to do with bash4 issues, and they
break in 'set -u' environments, because $ZSH_VERSION is, of course,
undefined in bash.
Best,
Gábor
next prev parent reply other threads:[~2010-12-02 22:36 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 [this message]
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
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=20101202223601.GA3577@neumann \
--to=szeder@ira.uka.de \
--cc=git@vger.kernel.org \
--cc=jrnieder@gmail.com \
--cc=peter@avirtualhome.com \
--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.
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).