From: Brandon Casey <bcasey@nvidia.com>
To: <gitster@pobox.com>
Cc: <git@vger.kernel.org>, Brandon Casey <drafnel@gmail.com>
Subject: [PATCH 2/3] t9902-completion.sh: old Bash still does not support array+=('') notation
Date: Wed, 21 Aug 2013 13:49:32 -0700 [thread overview]
Message-ID: <1377118173-23405-2-git-send-email-bcasey@nvidia.com> (raw)
In-Reply-To: <1377118173-23405-1-git-send-email-bcasey@nvidia.com>
From: Brandon Casey <drafnel@gmail.com>
Old Bash (3.0) which is distributed with RHEL 4.X and other ancient
platforms that are still in wide use, does not understand the
array+=() notation. Let's use an explicit assignment to the new array
element which works everywhere, like:
array[${#array[@]}+1]=''
The right-hand side '' is not strictly necessary, but in this case
I think it is more clear.
Signed-off-by: Brandon Casey <drafnel@gmail.com>
---
t/t9902-completion.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
index 272a071..2d4beb5 100755
--- a/t/t9902-completion.sh
+++ b/t/t9902-completion.sh
@@ -69,7 +69,7 @@ run_completion ()
local -a COMPREPLY _words
local _cword
_words=( $1 )
- test "${1: -1}" = ' ' && _words+=('')
+ test "${1: -1}" = ' ' && _words[${#_words[@]}+1]=''
(( _cword = ${#_words[@]} - 1 ))
__git_wrap__git_main && print_comp
}
--
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.
-----------------------------------------------------------------------------------
next prev parent 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 [PATCH 1/3] git-completion.bash: use correct Bash/Zsh array length syntax Brandon Casey
2013-08-21 20:49 ` Brandon Casey [this message]
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-2-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).