Re: [PATCH v2 1/1] ref-filter: sort detached HEAD lines firstly
- From
Jeff King <peff@peff.net>
- Date
- Jun 13, 2019, 16:58 UTC
- Message-ID
- <20190613165809.GA13031@sigill.intra.peff.net>
- In-Reply-To
- <nycvar.QRO.7.76.6.1906122118380.789@QRFXGBC-DHN364S.ybpnyqbznva>
On Wed, Jun 12, 2019 at 09:51:33PM +0200, Johannes Schindelin wrote:
Show 13 quoted lines
> > + head -n 1 actual >first && > > + # The first line should be enclosed by full-width parenthesis. > > + grep "(.*)" first && > > I wonder whether it is a good idea to pretend that we can pass arbitrary > byte sequences to `grep`, independent of the current locale. On Windows, > this does not hold true, for example. > > It would probably make more sense to store a support file in t/t3207/, > much like it is done in t3900. > > And once you do that, you can simply `test_cmp t3207/first first`. No > need to `grep` for `master` in addition:
I was just writing a similar response in another part of the thread, and found this. :)
In addition to grep portability problems, IMHO the source with the raw UTF-8 characters is harder to read. Even if your editor and terminal support UTF-8, people without the right fonts will just get a bunch of empty boxes. And when debugging, you often care about the raw bytes anyway (e.g., when there are multiple representations of the same glyph).
Adding a support file is fine, but for small cases like this, it may be easier to do:
printf '\357\274\210...' >expect
but note that this _must_ be octal, not hex, as many versions of printf only handle the former.
-Peff