Re: [PATCH v3] sparse-checkout: improve OS ls compatibility
- From
Ed Maste <emaste@freebsd.org>
- Date
- Dec 20, 2019, 18:34 UTC
- Message-ID
- <CAPyFy2AF+zcriUfZnpbXy+9r7hRpNBUe0agMuan-cE1ryqTipw@mail.gmail.com>
- In-Reply-To
- <xmqqftheamea.fsf@gitster-ct.c.googlers.com>
On Fri, 20 Dec 2019 at 13:21, Junio C Hamano <gitster@pobox.com> wrote:
Show 5 quoted lines
> > "This is similar to ls" is not all that important, especially if we > then need to say how different from "ls" ours is. The log message > that describes why we needed to move away from "ls" is a good place > to say what aspect of "ls" was unsuitable.
Ok, I'm also happy if it goes in with no comment; the reason I added it is I could foresee someone coming along in a few years, thinking this is just a strange local implementation of ls, and changing it. But, perhaps we can assume that any such person would check the history before doing so and the comment is not needed.
Show 8 quoted lines
> 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.
Indeed, that is more direct, although it's not just FreeBSD ls; this came from 4.2BSD and is probably common to most/all non-GNU ls implementations. In particular, macOS behaves the same way. (Also, the replacement would be even simpler, just "ls $1".)