From: "Torsten Bögershausen" <tboegi@web.de>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: "Torsten Bögershausen" <tboegi@web.de>,
"Git Mailing List" <git@vger.kernel.org>
Subject: Re: t5801-remote-helpers.sh fails
Date: Sun, 18 Nov 2012 06:50:16 +0100 [thread overview]
Message-ID: <50A87718.4030806@web.de> (raw)
In-Reply-To: <CAMP44s2yenQKSgdUXfZP+yDJJ+bdveyms=SQ+3ptPvpT6D0hsg@mail.gmail.com>
On 10.11.12 23:05, Felipe Contreras wrote:
> On Sat, Nov 10, 2012 at 8:20 PM, Torsten Bögershausen <tboegi@web.de> wrote:
>> On 11/10/2012 08:15 PM, Felipe Contreras wrote:
>>>
>>> Hi,
>>>
>>> On Sat, Nov 10, 2012 at 2:48 PM, Torsten Bögershausen <tboegi@web.de>
>>> wrote:
>>>
>>>> on peff/pu t5801 fails, the error is in git-remote-testgit, please see
>>>> below.
>>>>
>>>> That's on my Mac OS X box.
>>>>
>>>> I haven't digged further into the test case, but it looks as if
>>>> "[-+]A make NAMEs associative arrays"
>>>> is not supported on this version of bash.
>>>> /Torsten
>>>>
>>>>
>>>> /Users/tb/projects/git/git.peff/git-remote-testgit: line 64: declare: -A:
>>>> invalid option
>>>> declare: usage: declare [-afFirtx] [-p] [name[=value] ...]
>>>> /Users/tb/projects/git/git.peff/git-remote-testgit: line 66:
>>>> refs/heads/master: division by 0 (error token is "/master")
>>>> error: fast-export died of signal 13
>>>> fatal: Error while running fast-export
>>>
>>>
>>> What is your bash --version?
>>>
>> bash --version
>> GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin10.0)
>> Copyright (C) 2007 Free Software Foundation, Inc.
>
> I see, that version indeed doesn't have associative arrays.
>
>> On the other hand, Documentation/CodingGuidelines says:
>> - No shell arrays.
>
> Yeah, for shell code I guess, but this is bash code.
>
>> Could we use perl to have arrays?
>
> I think the code in perl would be harder to follow, and this is meant
> not only as a test, but also as a reference.
>
> I'm not exactly sure what we should do here:
>
> a) remove the code (would not be so good as a reference)
> b) enable the code conditionally based on the version of bash (harder to read)
> c) replace the code without associative arrays (will be much more
> complicated and ugly)
> d) add a check for the bash version to the top of the test in t/
>
> I'm leaning towards d), followed by b).
>
> If only there was a clean way to do this, so c) would not be so ugly.
>
> After investigating different optins this seems to be the best:
>
> join -e empty -o '0 1.2 2.2' -a 2 <(echo "$before") <(echo "$after")
> | while read e a b; do
> test "$a" == "$b" && continue
> echo "changed $e"
> done
>
> But to me seems a bit harder to grasp. Not sure.
>
> Cheers.
>
Hi again,
I managed to have a working solution for
"d) add a check for the bash version to the top of the test in t/"
Please see diff below.
This unbreaks the test suite here.
Is this a good way forward?
Filipe, does the code line you mention above work for you?
If yes: I can test it here, if you send it as a patch.
/Torsten
diff --git a/t/t5801-remote-helpers.sh b/t/t5801-remote-helpers.sh
old mode 100644
new mode 100755
index 6e4e078..ea3d0f3
--- a/t/t5801-remote-helpers.sh
+++ b/t/t5801-remote-helpers.sh
@@ -13,6 +13,15 @@ compare_refs() {
test_cmp expect actual
}
+cat >"testbashArray" <<-EOF
+ declare -A assa
+EOF
+
+/bin/bash testbashArray || {
+ skip_all='t5801. /bin/bash does not handle associative arrays'
+ test_done
+}
+
test_expect_success 'setup repository' '
git init server &&
(cd server &&
next prev parent reply other threads:[~2012-11-18 5:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-10 13:48 t5801-remote-helpers.sh fails Torsten Bögershausen
2012-11-10 19:15 ` Felipe Contreras
2012-11-10 19:20 ` Torsten Bögershausen
2012-11-10 22:05 ` Felipe Contreras
2012-11-18 5:50 ` Torsten Bögershausen [this message]
2012-11-18 8:23 ` Felipe Contreras
2012-11-18 15:52 ` Torsten Bögershausen
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=50A87718.4030806@web.de \
--to=tboegi@web.de \
--cc=felipe.contreras@gmail.com \
--cc=git@vger.kernel.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.
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).