Re: [PATCH] t7406: fix breakage on OSX
- From
Stefan Beller <sbeller@google.com>
- Date
- Aug 10, 2016, 19:03 UTC
- Message-ID
- <CAGZ79kb5Sy6rC1j8uLq+oCTfVVpan0tgat59yOJV20nFeRzSKQ@mail.gmail.com>
- In-Reply-To
- <xmqq1t1w5vk6.fsf@gitster.mtv.corp.google.com>
On Wed, Aug 10, 2016 at 11:27 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 17 quoted lines
> Stefan Beller <sbeller@google.com> writes: > >> On OSX `wc` prefixes the output of numbers with whitespace, such that >> the `commit_count` would be "SP <NUMBER>". When using that in >> >> git submodule update --init --depth=$commit_count >> >> the depth would be empty and the number is interpreted as the pathspec. >> Fix this by not using `wc` and rather instruct rev-list to count. >> >> Another way to fix this is to remove the `=` sign after the `--depth` >> argument as then we are allowed to have more than just one whitespace >> between `--depth` and the actual number. Prefer the solution of rev-list >> counting as that is expected to be slightly faster and more self-sustained >> within Git. > > You meant self-contained, I would guess.
Yes. Mind to fix that locally, or waiting for a resend?
> > There are a couple of "log --oneline | wc -l" remaining that are > currently safe but they may be a time-bomb waiting to go off.
$ grep -r "log --oneline | wc -l" t6050-replace.sh: test $(git log --oneline | wc -l) = 7 && t6050-replace.sh: test $(git log --oneline | wc -l) = 3 && t7406-submodule-update.sh: test 1 = $(git -C submodule log --oneline | wc -l) t7406-submodule-update.sh: test 1 = $(git -C submodule log --oneline | wc -l) t7400-submodule-basic.sh: test 1 = $(git log --oneline | wc -l)
All of the occurrences are not white space sensitive AFAICT, they are just bad examples, which may inspire others to follow that pattern.
Thanks, Stefan