Re: [PATCH 1/3] fast-export: allow dumping the refname mapping

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jun 19, 2020 at 12:18:16PM -0400, Eric Sunshine wrote:

> > That's exactly what I wrote originally, but it failed on macos due to
> > extra spaces in the "wc" output.
> 
> Hmph, that shouldn't have failed. Did you quote the $(wc -l refs)
> invocation? Quoting it would cause it to fail.

Nope (and indeed, I was wary of the issue and made sure I didn't use
quotes). My original was:

test_expect_success 'refname mapping can be dumped' '
       git fast-export --anonymize --all \
               --dump-anonymized-refnames=refs.out >/dev/null &&
       # we make no guarantees of the exact anonymized names,
       # so just check that we have the right number and
       # that a sample line looks sane.
       expected_count=$(git for-each-ref | wc -l) &&
       # Note that master is not anonymized, and so not included
       # in the mapping.
       expected_count=$((expected_count - 1)) &&
       test_line_count = "$expected_count" refs.out &&
       grep "^refs/heads/other refs/heads/" refs.out
'

So I guess I did quote the variable later.  It works fine on Linux, but
one of the osx ci jobs failed:

  https://github.com/peff/git/runs/787911270

The relevant log is:

++ git fast-export --anonymize --all --dump-anonymized-refnames=refs.out
+++ git for-each-ref
+++ wc -l
++ expected_count='       7'
++ test_line_count = '       7' refs.out
++ test 3 '!=' 3
+++ wc -l
++ test 7 = '       7'
++ echo 'test_line_count: line count for refs.out !=        7'
test_line_count: line count for refs.out !=        7

so the whitespace is eaten not when "wc" is run, but rather when the
variable is expanded.

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux