git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brandon Casey <bcasey@nvidia.com>
To: <gitster@pobox.com>
Cc: <git@vger.kernel.org>, Brandon Casey <drafnel@gmail.com>
Subject: [PATCH 1/3] git-completion.bash: use correct Bash/Zsh array length syntax
Date: Wed, 21 Aug 2013 13:49:31 -0700	[thread overview]
Message-ID: <1377118173-23405-1-git-send-email-bcasey@nvidia.com> (raw)

From: Brandon Casey <drafnel@gmail.com>

The syntax for retrieving the number of elements in an array is:

   ${#name[@]}

Signed-off-by: Brandon Casey <drafnel@gmail.com>
---
 contrib/completion/git-completion.bash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 5da920e..e1b7313 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2580,7 +2580,7 @@ if [[ -n ${ZSH_VERSION-} ]]; then
 				--*=*|*.) ;;
 				*) c="$c " ;;
 				esac
-				array[$#array+1]="$c"
+				array[${#array[@]}+1]="$c"
 			done
 			compset -P '*[=:]'
 			compadd -Q -S '' -p "${2-}" -a -- array && _ret=0
-- 
1.8.4.rc0.2.g6cf5c31


-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

             reply	other threads:[~2013-08-21 20:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-21 20:49 Brandon Casey [this message]
2013-08-21 20:49 ` [PATCH 2/3] t9902-completion.sh: old Bash still does not support array+=('') notation Brandon Casey
2013-08-21 20:49 ` [PATCH 3/3] Revert "bash prompt: avoid command substitution when finalizing gitstring" Brandon Casey
2013-08-21 21:47   ` Junio C Hamano
2013-08-21 22:08     ` Brandon Casey
2013-08-22  0:22       ` Junio C Hamano
2013-08-22  0:33         ` Brandon Casey
2013-08-22  1:17           ` [PATCH] contrib/git-prompt.sh: handle missing 'printf -v' more gracefully Brandon Casey
2013-08-22  1:39             ` Brandon Casey
2013-08-22  1:27           ` [PATCH 3/3] Revert "bash prompt: avoid command substitution when finalizing gitstring" Junio C Hamano

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=1377118173-23405-1-git-send-email-bcasey@nvidia.com \
    --to=bcasey@nvidia.com \
    --cc=drafnel@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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).