Re: [PATCH v8] ls-files: introduce "--format" option
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 21, 2022, 17:23 UTC
- Message-ID
- <xmqqsfmuidmp.fsf@gitster.g>
- In-Reply-To
- <220721.86ilnqtq8f.gmgdl@evledraar.gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 9 quoted lines
>>> +test_expect_success 'git ls-files --format objectmode v.s. -s' '
>>> -+ git ls-files -s | awk "{print \$1}" >expect &&
>>> ++ git ls-files -s >files &&
>>> ++ cut -d" " -f1 files >expect &&
>>
>> Either "awk" or "cut" is fine and flipping between them is a bit
>> distracting. Cutting the pipe into two is a good move.
>
> That "cut" suggestion saw mine, sorry about the churn...As I said "cut" is perfectly fine. Unless this part goes away, (i.e. perhaps we may decide that it is a bad idea to check only the pieces of lines), let's not flip back to awk ;-)
Show 10 quoted lines
>> format="%(objectmode) %(objectname) %(stage) %(path)" && >> git ls-files -s >expect && >> git ls-files --format="$format" >actual && >> test_cmp expect actual >> >> I do not know if the $format I wrote without looking at the doc is >> correct, but you get the idea. > > Past rounds moved some tests towards that, maybe that's a good thing > here too I didn't look deeply this time around...
OK, thanks for reviewing.