Re: [PATCH v2 01/10] ls-files: add --json to dump the index
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 25, 2019, 22:28 UTC
- Message-ID
- <xmqqk1d9e1vb.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <nycvar.QRO.7.76.6.1906251142580.44@tvgsbejvaqbjf.bet>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 10 quoted lines
>> + echo 's/\("'$name'":\) [0-9]\+/\1 <number>/' >>filter.sed
>
> This does not do what you think it does, in Ubuntu Xenial and on macOS:
>
> https://dev.azure.com/gitgitgadget/git/_build/results?buildId=11408&view=ms.vss-test-web.build-test-results-tab&runId=27736&paneView=debug&resultId=105613
>
> The `\1` is expanded to the ASCII character 001. Therefore your test cases
> fail on almost all platforms.
>
> Funnily enough, they pass on Windows...bash, dash and /bin/echo behave differently given
$ echo 'foo \1 bar'
some 'echo' suffer from the "\<n>" interpolation. Some don't.
I think your spelled-out version downthread (except for stepping out of BRE which would break your sed script, as you realized) would be a much readable alternative.
Thanks.