Re: [PATCH v3] sparse-checkout: improve OS ls compatibility
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Dec 20, 2019, 18:34 UTC
- Message-ID
- <CAPig+cQ29dEbQgnJmGvODy9kGYq9TqKaJV5-mOPXbGFZ1HRWmw@mail.gmail.com>
- In-Reply-To
- <xmqqftheamea.fsf@gitster-ct.c.googlers.com>
On Fri, Dec 20, 2019 at 1:21 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 14 quoted lines
> Eric Sunshine <sunshine@sunshineco.com> writes: > > anomalous behavior is still present. It would be helpful, therefore, > > to mention such an implementation by name: > > > > ...some 'ls' implementations, such as on FreeBSD, include... > > > If we _were_ to add an in-code comment, we may want to say something > like > > # Do not replace this with "cd "$1" && ls", as FreeBSD "ls" > # enables "-A" when run by root without being told, and ends > # up including ".git" etc. in its output. > > to warn future developers against improving and/or cleaning up.
I would find this comment more helpful than the existing one since it spells out the issue precisely. A minor tweak:
# Do not replace this with "cd "$1" && ls", as FreeBSD "ls"
# enables "-A" by default when run by root, and ends up
# including ".git" etc. in its output.> Not that we encourage running our tests as root, though. I am > slightly worried that the above phrasing might be taken as such.
I'm not sure we really need to spell it out, but something like this might allay that concern:
# Do not replace this with "cd "$1" && ls", as FreeBSD "ls"
# enables "-A" by default when run by root, and ends up
# including ".git" etc. in its output. (Note, though, that
# running the test suite as root is generally not
# recommended.)