Re: [PATCH v4 6/6] list-objects-filter: implement filter tree:0
- From
Matthew DeVore <matvore@google.com>
- Date
- Aug 14, 2018, 23:30 UTC
- Message-ID
- <CAMfpvh+H5UeHmCqeVNZNoOe_-vgH3_3aTuO+c=imgzaVkC6N2g@mail.gmail.com>
- In-Reply-To
- <xmqqa7pozmzv.fsf@gitster-ct.c.googlers.com>
On Tue, Aug 14, 2018 at 1:55 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 24 quoted lines
> > Jonathan Tan <jonathantanmy@google.com> writes: > > >> - grep -E "tree|blob" objs >trees_and_blobs && > >> - test_line_count = 1 trees_and_blobs > >> + grep -E "tree|blob" objs \ > >> + | awk -f print_1.awk >trees_and_blobs && > >> + git -C r1 rev-parse HEAD: >expected && > >> + test_cmp trees_and_blobs expected > > > > Indent "| awk" (and similar lines in this patch) - although I guess it > > is likely that you actually have it indented, and your e-mail client > > modified the whitespace so that it looks like there is no indent. > > No, wrap lines like this > > command1 arg1 arg2 | > command2 arg1 arg2 && > > That way, you do not need backslash to continue line. > > Also think twice when you are seeing yourself piping output from > "grep" to more powerful tools like "perl", "awk" or "sed". Often > you can lose the upstream "grep".
Thank you. I changed it to this:
awk -e "/tree|blob/{print \$1}" objs >trees_and_blobsAbout the line wrapping strategy, the files I've edited all did it with the \ and the | at the start of subsequent lines - so I made my code match that style. Otherwise I would have liked to use the style you suggest...