Re: mac test failure -- test 3301

2014-11-11 Thread Junio C Hamano
Johan Herland jo...@herland.net writes:

 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?

It is not a good practice to blindly follow any guideline ;-).

When you anticipate that different platforms throw you unnecessary
spaces around a single token you expect to see, not quoting is
obviously the right thing.  If you are unsure if the comamand gives
you one or multiple tokens, you obviously risk the output getting
split by not quoting.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: mac test failure -- test 3301

2014-11-11 Thread Johan Herland
On Tue, Nov 11, 2014 at 3:41 AM, Jeff King p...@peff.net wrote:
 On Tue, Nov 11, 2014 at 02:40:19AM +0100, Johan Herland wrote:
  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?

 It usually is a good idea to prevent whitespace splitting by the shell
 (and especially with things that might unexpectedly be empty, in which
 case they end up as no argument and not an empty one). So yeah, this
 is an exception.

 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:

 I think we have test_line_count exactly because of this unportability
 with wc output.

 You'd want:

   git ls-tree refs/notes/commits actual 
   test_line_count = 1 actual

 or similar.

Thanks. Will use this in the re-roll.

 By the way, the point of that ls-tree appears to be to check the
 number of total notes stored. Since notes are stored in a hashed
 structure, should it be ls-tree -r? Otherwise, we see only the leading
 directories; two notes whose sha1s start with the same two characters
 would be considered a single entry.

Yes and no... The notes' nested fanout structure is developed
dynamically as the number of notes increase. As long as the number of
notes stay low, the notes tree remain at fanout level 0 (i.e. no
nesting), so ls-tree happens to work here. Still ls-tree -r is the
correct for any size notes tree. Will fix to use ls-tree -r.


...Johan

-- 
Johan Herland, jo...@herland.net
www.herland.net
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: mac test failure -- test 3301

2014-11-10 Thread Michael Blume
(to be clear: I ran git bisect, and traced the problem to the modernize commit)

On Mon, Nov 10, 2014 at 4:17 PM, Michael Blume blume.m...@gmail.com wrote:
 the commit modernizing test 3301
 (https://github.com/git/git/commit/fbe4f74865acfd) appears to break it
 on my mac

 Verbose output follows:

 $ ./t3301-notes.sh -v
 Initialized empty Git repository in
 /Users/michael.blume/workspace/git/t/trash directory.t3301-notes/.git/
 expecting success:
 test_must_fail env MSG=3 git notes add

 fatal: Failed to resolve 'HEAD' as a valid ref.
 ok 1 - cannot annotate non-existing HEAD

 expecting success:
 test_commit 1st 
 test_commit 2nd

 [master (root-commit) 04ed9a0] 1st
  Author: A U Thor aut...@example.com
  1 file changed, 1 insertion(+)
  create mode 100644 1st.t
 [master 7a4ca6e] 2nd
  Author: A U Thor aut...@example.com
  1 file changed, 1 insertion(+)
  create mode 100644 2nd.t
 ok 2 - setup

 expecting success:
 test_must_fail env MSG=1 GIT_NOTES_REF=/ git notes show 
 test_must_fail env MSG=2 GIT_NOTES_REF=/ git notes show

 fatal: Refusing to show notes in / (outside of refs/notes/)
 fatal: Refusing to show notes in / (outside of refs/notes/)
 ok 3 - need valid notes ref

 expecting success:
 test_must_fail env MSG=1 GIT_NOTES_REF=refs/heads/bogus git notes add

 fatal: Refusing to add notes in refs/heads/bogus (outside of refs/notes/)
 ok 4 - refusing to add notes in refs/heads/

 expecting success:
 test_must_fail env MSG=1 GIT_NOTES_REF=refs/heads/bogus git notes edit

 fatal: Refusing to edit notes in refs/heads/bogus (outside of refs/notes/)
 ok 5 - refusing to edit notes in refs/remotes/

 expecting success:
 test_expect_code 1 git notes show

 error: No note found for object 7a4ca6ee52a974a66cbaa78e33214535dff1d691.
 ok 6 - handle empty notes gracefully

 expecting success:
 test_write_lines A B expect 
 git show -s --format=A%n%NB output 
 test_cmp expect output

 ok 7 - show non-existent notes entry with %N

 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
 #
 # 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^
 #

 expecting success:
 test_write_lines A b4 B expect 
 git show -s --format=A%n%NB output 
 test_cmp expect output

 ok 9 - show notes entry with %N

 expecting success:
 cat -EOF expect 
 a1d8fa6 refs/notes/commits@{0}: notes: Notes added by 'git notes add'
 EOF
 git reflog show refs/notes/commits output 
 test_cmp expect output

 ok 10 - create reflog entry

 expecting success:
 MSG=b3 git notes edit 
 test_path_is_missing .git/NOTES_EDITMSG 
 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^

 b3
 not ok 11 - 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 b3 = $(git notes show) 
 # git show HEAD^ 
 # test_must_fail git notes show HEAD^
 #

 expecting success:
 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 b3 = $(git notes show) 
 git show HEAD^ 
 test_must_fail git notes show HEAD^

 error: Cannot add notes. Found existing notes for object
 7a4ca6ee52a974a66cbaa78e33214535dff1d691. Use '-f' to overwrite
 existing notes
 not ok 12 - 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 b3 = $(git notes show) 
 # git show HEAD^ 
 # test_must_fail git notes show HEAD^
 #

 expecting success:
 git notes add -f -m b1 
 test_path_is_missing .git/NOTES_EDITMSG 
 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^

 Overwriting existing notes for object 7a4ca6ee52a974a66cbaa78e33214535dff1d691
 not ok 13 - 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 b1 = $(git notes show) 
 # git show HEAD^ 
 # test_must_fail git notes show HEAD^
 #

 expecting success:
 MSG=b2 git notes add 
 test_path_is_missing .git/NOTES_EDITMSG 
 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^

 b2
 not ok 14 - 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 b2 = $(git notes show) 
 # 

Re: mac test failure -- test 3301

2014-11-10 Thread Michael Blume
my first thought was that this might be a bash versioning issue, since
the commit in question basically refactors the script, and macs ship
with an archaic version of bash, but I have the same problem with bash
4.3.30

On Mon, Nov 10, 2014 at 4:23 PM, Michael Blume blume.m...@gmail.com wrote:
 (to be clear: I ran git bisect, and traced the problem to the modernize 
 commit)

 On Mon, Nov 10, 2014 at 4:17 PM, Michael Blume blume.m...@gmail.com wrote:
 the commit modernizing test 3301
 (https://github.com/git/git/commit/fbe4f74865acfd) appears to break it
 on my mac

 Verbose output follows:

 $ ./t3301-notes.sh -v
 Initialized empty Git repository in
 /Users/michael.blume/workspace/git/t/trash directory.t3301-notes/.git/
 expecting success:
 test_must_fail env MSG=3 git notes add

 fatal: Failed to resolve 'HEAD' as a valid ref.
 ok 1 - cannot annotate non-existing HEAD

 expecting success:
 test_commit 1st 
 test_commit 2nd

 [master (root-commit) 04ed9a0] 1st
  Author: A U Thor aut...@example.com
  1 file changed, 1 insertion(+)
  create mode 100644 1st.t
 [master 7a4ca6e] 2nd
  Author: A U Thor aut...@example.com
  1 file changed, 1 insertion(+)
  create mode 100644 2nd.t
 ok 2 - setup

 expecting success:
 test_must_fail env MSG=1 GIT_NOTES_REF=/ git notes show 
 test_must_fail env MSG=2 GIT_NOTES_REF=/ git notes show

 fatal: Refusing to show notes in / (outside of refs/notes/)
 fatal: Refusing to show notes in / (outside of refs/notes/)
 ok 3 - need valid notes ref

 expecting success:
 test_must_fail env MSG=1 GIT_NOTES_REF=refs/heads/bogus git notes add

 fatal: Refusing to add notes in refs/heads/bogus (outside of refs/notes/)
 ok 4 - refusing to add notes in refs/heads/

 expecting success:
 test_must_fail env MSG=1 GIT_NOTES_REF=refs/heads/bogus git notes edit

 fatal: Refusing to edit notes in refs/heads/bogus (outside of refs/notes/)
 ok 5 - refusing to edit notes in refs/remotes/

 expecting success:
 test_expect_code 1 git notes show

 error: No note found for object 7a4ca6ee52a974a66cbaa78e33214535dff1d691.
 ok 6 - handle empty notes gracefully

 expecting success:
 test_write_lines A B expect 
 git show -s --format=A%n%NB output 
 test_cmp expect output

 ok 7 - show non-existent notes entry with %N

 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
 #
 # 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^
 #

 expecting success:
 test_write_lines A b4 B expect 
 git show -s --format=A%n%NB output 
 test_cmp expect output

 ok 9 - show notes entry with %N

 expecting success:
 cat -EOF expect 
 a1d8fa6 refs/notes/commits@{0}: notes: Notes added by 'git notes add'
 EOF
 git reflog show refs/notes/commits output 
 test_cmp expect output

 ok 10 - create reflog entry

 expecting success:
 MSG=b3 git notes edit 
 test_path_is_missing .git/NOTES_EDITMSG 
 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^

 b3
 not ok 11 - 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 b3 = $(git notes show) 
 # git show HEAD^ 
 # test_must_fail git notes show HEAD^
 #

 expecting success:
 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 b3 = $(git notes show) 
 git show HEAD^ 
 test_must_fail git notes show HEAD^

 error: Cannot add notes. Found existing notes for object
 7a4ca6ee52a974a66cbaa78e33214535dff1d691. Use '-f' to overwrite
 existing notes
 not ok 12 - 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 b3 = $(git notes show) 
 # git show HEAD^ 
 # test_must_fail git notes show HEAD^
 #

 expecting success:
 git notes add -f -m b1 
 test_path_is_missing .git/NOTES_EDITMSG 
 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^

 Overwriting existing notes for object 
 7a4ca6ee52a974a66cbaa78e33214535dff1d691
 not ok 13 - 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 b1 = $(git notes show) 
 # git show HEAD^ 
 # test_must_fail git notes show HEAD^
 #

 expecting success:
 MSG=b2 git notes add 
 test_path_is_missing .git/NOTES_EDITMSG 
 test 1 = $(git ls-tree refs/notes/commits | wc -l) 
 test b2 = 

Re: mac test failure -- test 3301

2014-11-10 Thread Eric Sunshine
On Mon, Nov 10, 2014 at 7:17 PM, Michael Blume blume.m...@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 $().
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: mac test failure -- test 3301

2014-11-10 Thread Johan Herland
On Tue, Nov 11, 2014 at 2:19 AM, Eric Sunshine sunsh...@sunshineco.com wrote:
 On Mon, Nov 10, 2014 at 7:17 PM, Michael Blume blume.m...@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, jo...@herland.net
www.herland.net
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: mac test failure -- test 3301

2014-11-10 Thread Michael Blume
If quoting is generally preferred as a best practice, we could force
wc to behave more consistently before we start testing

diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index 0d93e33..57ed608 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -515,6 +515,14 @@ test_path_is_missing () {
  fi
 }

+# Some platforms disagree about wc output format.
+
+SYS_WC=$(which wc)
+
+wc () {
+ $SYS_WC $@ | sed -e 's/^ *//' -e 's/ *$//'
+}
+
 # test_line_count checks that a file has the number of lines it
 # ought to. For example:
 #

On Mon, Nov 10, 2014 at 5:40 PM, Johan Herland jo...@herland.net wrote:
 On Tue, Nov 11, 2014 at 2:19 AM, Eric Sunshine sunsh...@sunshineco.com 
 wrote:
 On Mon, Nov 10, 2014 at 7:17 PM, Michael Blume blume.m...@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, jo...@herland.net
 www.herland.net
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: mac test failure -- test 3301

2014-11-10 Thread Jeff King
On Tue, Nov 11, 2014 at 02:40:19AM +0100, Johan Herland wrote:

  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?

It usually is a good idea to prevent whitespace splitting by the shell
(and especially with things that might unexpectedly be empty, in which
case they end up as no argument and not an empty one). So yeah, this
is an exception.

 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:

I think we have test_line_count exactly because of this unportability
with wc output.

You'd want:

  git ls-tree refs/notes/commits actual 
  test_line_count = 1 actual

or similar.

By the way, the point of that ls-tree appears to be to check the
number of total notes stored. Since notes are stored in a hashed
structure, should it be ls-tree -r? Otherwise, we see only the leading
directories; two notes whose sha1s start with the same two characters
would be considered a single entry.

-Peff
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html