Re: [PATCH 08/16] test-lib functions: add --printf option to test_commit
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Apr 12, 2021, 23:04 UTC
- Message-ID
- <CAPig+cQSS8yp-K8Z5q9eG1t-7sFAyuPEvFDNvX_JaY07BKcMhQ@mail.gmail.com>
- In-Reply-To
- <xmqqk0p7b3d5.fsf@gitster.g>
On Mon, Apr 12, 2021 at 5:27 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 16 quoted lines
> Eric Sunshine <sunshine@sunshineco.com> writes: > > The name "printf" has such strong association in programmer's minds > > with "%" and argument consumption that the name of this option alone > > almost begs people to take advantage of argument interpolation even > > though it's documented here as not allowing it. Taking into > > consideration that people often do not read documentation, `--printf` > > as the name of the option may be an unfortunate one. Perhaps it could > > be called `--raw` or something less likely to suggest argument > > interpolation. > > The reason we want to use 'printf' instead of 'echo' is because only > some implementations of 'echo' honors '\t\n\r' etc., and 'echo' by > others show these literally. Using printf(1) allows us to write > these backslashed special characters universally. > > So, I find 'raw' equally confusing, if not more.
I don't care for `--raw` either but couldn't think of anything better at the time. But perhaps a name such as `--allow-escapes` would be clearer, or perhaps not. `--c-style-escapes`?
Anyhow, it's pure bikeshedding as I mentioned in my original email, so not a big deal. I brought it up only because the very first thought that popped into my head when reading the commit message saying it was adding `--printf` was "oh, interesting; how do I specify the arguments to interpolate into the `printf` format string?".