On Wed, Oct 01, 2014 at 10:11:04AM -0400, Eric Sunshine wrote:

> > +echo20() {
> > +       prefix="$1"
> > +       shift
> > +       while test $# -gt 0
> > +       do
> > +               echo "$prefix$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1"
> 
> Each caller of echo20() manually includes a space at the end of
> $prefix. Would it make sense to instead have echo20() do this on
> behalf of the caller?
> 
>     echo "$prefix $1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1"

Not always. For example:

> > +test_expect_success 'ordered enumeration' '
> > +       echo20 "" 44 55 88 aa >expect &&

This does not.

> > +       {
> > +               echo20 "append " 88 44 aa 55 &&
> 
> Which would slightly reduce the burden on the caller and make it read
> (very slightly) nicer:
> 
>     echo20 append 88 44 aa 55 &&

I agree that is more readable. But you'd have to make echo20 more like:

  if test -n "$1"; then
          prefix="$1 "
  else
          prefix=""
  fi

which is not too bad.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to