On Fri, Aug 31, 2018 at 2:21 PM Torsten Bögershausen <tbo...@web.de> wrote:
> > diff --git a/t/t0027-auto-crlf.sh b/t/t0027-auto-crlf.sh
> > @@ -14,11 +14,13 @@ compare_files () {
> >  compare_ws_file () {
> > +     tmp=$2.tmp
> >       act=$pfx.actual.$3
> > -     tr '\015\000abcdef0123456789' QN00000000000000000 <"$2" >"$exp" &&
> > +     tr '\015\000abcdef0123456789' QN00000000000000000 <"$2" >"$tmp" &&
> >       tr '\015\000abcdef0123456789' QN00000000000000000 <"$3" >"$act" &&
> > +     sed -e "s/0000*/$ZERO_OID/" "$tmp" >"$exp" &&
>
> Out of interest: why do we use a "tmp" file here?
> Would it make more sense  to chain the 'tr' with 'sed' and skip the
> tmp file ?
>
>         tr '\015\000abcdef0123456789' QN00000000000000000 <"$2" |
>         sed -e "s/0000*/$ZERO_OID/"  >"$exp" &&
>
> Yes, we will loose the exit status of 'tr', I think.
> How important is the exit status ?

As far as I understand, it is only Git commands for which we worry
about losing the exit status upstream in pipes. System utilities, on
the other hand, are presumed to be bug-free, thus we don't mind having
them upstream.

A different question is why does this need to run both 'tr' and 'sed'
when 'sed itself could do the entire job since 'sed' has 'tr'
functionality built in (see sed's "y" command)?

Reply via email to