git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Herland <johan@herland.net>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: Michael Blume <blume.mike@gmail.com>, Git List <git@vger.kernel.org>
Subject: Re: mac test failure -- test 3301
Date: Tue, 11 Nov 2014 02:40:19 +0100	[thread overview]
Message-ID: <CALKQrgexnrCy-P6yTZB+U0--5peaTys9KqB+KGKqbAuyLA=NqA@mail.gmail.com> (raw)
In-Reply-To: <CAPig+cRxCj82F5aak0Y+Ce_SvUETtQ5dwM1RtzjUUvwtJ=WPYw@mail.gmail.com>

On Tue, Nov 11, 2014 at 2:19 AM, Eric Sunshine <sunshine@sunshineco.com> wrote:
> On Mon, Nov 10, 2014 at 7:17 PM, Michael Blume <blume.mike@gmail.com> wrote:
>> the commit modernizing test 3301
>> (https://github.com/git/git/commit/fbe4f74865acfd) appears to break it
>> on my mac
>>
>> $ ./t3301-notes.sh -v
>> expecting success:
>> MSG=b4 git notes add &&
>> test_path_is_missing .git/NOTES_EDITMSG &&
>> test "1" = "$(git ls-tree refs/notes/commits | wc -l)" &&
>> test "b4" = "$(git notes show)" &&
>> git show HEAD^ &&
>> test_must_fail git notes show HEAD^
>>
>> b4
>> not ok 8 - create notes
>
> This and all other failures are due to the output of 'wc -l', which on
> Mac is "{whitespace}1" rather than just "1" as it is on other
> platforms. fbe4f748 added quotes around the $(... | wc -l) invocation
> which caused the whitespace to be retained. A minimum fix would be to
> drop the quotes surrounding $().

Ah, thanks!

I thought that quoting command output was a good idea in general. Am I
wrong, or is this just one exception to an otherwise good guideline?

Anyway, here is the minimal diff to remove quoting from the $(... | wc
-l) commands (probably whitespace damaged by GMail - sorry). Junio:
feel free to squash this in, or ask for a re-roll:

diff --git a/t/t3301-notes.sh b/t/t3301-notes.sh
index cd756ec..2c8abbc 100755
--- a/t/t3301-notes.sh
+++ b/t/t3301-notes.sh
@@ -52,7 +52,7 @@ test_expect_success 'show non-existent notes entry with %N' '
 test_expect_success 'create notes' '
     MSG=b4 git notes add &&
     test_path_is_missing .git/NOTES_EDITMSG &&
-    test "1" = "$(git ls-tree refs/notes/commits | wc -l)" &&
+    test "1" = $(git ls-tree refs/notes/commits | wc -l) &&
     test "b4" = "$(git notes show)" &&
     git show HEAD^ &&
     test_must_fail git notes show HEAD^
@@ -75,7 +75,7 @@ test_expect_success 'create reflog entry' '
 test_expect_success 'edit existing notes' '
     MSG=b3 git notes edit &&
     test_path_is_missing .git/NOTES_EDITMSG &&
-    test "1" = "$(git ls-tree refs/notes/commits | wc -l)" &&
+    test "1" = $(git ls-tree refs/notes/commits | wc -l) &&
     test "b3" = "$(git notes show)" &&
     git show HEAD^ &&
     test_must_fail git notes show HEAD^
@@ -84,7 +84,7 @@ test_expect_success 'edit existing notes' '
 test_expect_success 'cannot "git notes add -m" where notes already exists' '
     test_must_fail git notes add -m "b2" &&
     test_path_is_missing .git/NOTES_EDITMSG &&
-    test "1" = "$(git ls-tree refs/notes/commits | wc -l)" &&
+    test "1" = $(git ls-tree refs/notes/commits | wc -l) &&
     test "b3" = "$(git notes show)" &&
     git show HEAD^ &&
     test_must_fail git notes show HEAD^
@@ -93,7 +93,7 @@ test_expect_success 'cannot "git notes add -m" where
notes already exists' '
 test_expect_success 'can overwrite existing note with "git notes add -f -m"' '
     git notes add -f -m "b1" &&
     test_path_is_missing .git/NOTES_EDITMSG &&
-    test "1" = "$(git ls-tree refs/notes/commits | wc -l)" &&
+    test "1" = $(git ls-tree refs/notes/commits | wc -l) &&
     test "b1" = "$(git notes show)" &&
     git show HEAD^ &&
     test_must_fail git notes show HEAD^
@@ -102,7 +102,7 @@ test_expect_success 'can overwrite existing note
with "git notes add -f -m"' '
 test_expect_success 'add w/no options on existing note morphs into edit' '
     MSG=b2 git notes add &&
     test_path_is_missing .git/NOTES_EDITMSG &&
-    test "1" = "$(git ls-tree refs/notes/commits | wc -l)" &&
+    test "1" = $(git ls-tree refs/notes/commits | wc -l) &&
     test "b2" = "$(git notes show)" &&
     git show HEAD^ &&
     test_must_fail git notes show HEAD^
@@ -111,7 +111,7 @@ test_expect_success 'add w/no options on existing
note morphs into edit' '
 test_expect_success 'can overwrite existing note with "git notes add -f"' '
     MSG=b1 git notes add -f &&
     test_path_is_missing .git/NOTES_EDITMSG &&
-    test "1" = "$(git ls-tree refs/notes/commits | wc -l)" &&
+    test "1" = $(git ls-tree refs/notes/commits | wc -l) &&
     test "b1" = "$(git notes show)" &&
     git show HEAD^ &&
     test_must_fail git notes show HEAD^


...Johan

-- 
Johan Herland, <johan@herland.net>
www.herland.net

  reply	other threads:[~2014-11-11  1:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-11  0:17 mac test failure -- test 3301 Michael Blume
2014-11-11  0:23 ` Michael Blume
2014-11-11  0:46   ` Michael Blume
2014-11-11  1:19 ` Eric Sunshine
2014-11-11  1:40   ` Johan Herland [this message]
2014-11-11  1:46     ` Michael Blume
2014-11-11  2:41     ` Jeff King
2014-11-11 23:57       ` Johan Herland
2014-11-11 15:58     ` 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='CALKQrgexnrCy-P6yTZB+U0--5peaTys9KqB+KGKqbAuyLA=NqA@mail.gmail.com' \
    --to=johan@herland.net \
    --cc=blume.mike@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=sunshine@sunshineco.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).