git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/2] sha1-array: add test-sha1-array and basic tests

From
Jeff King <peff@peff.net>
Date
Oct 1, 2014, 14:23 UTC
Message-ID
<20141001142336.GA19992@peff.net>
In-Reply-To
<CAPig+cQxXccnQCwr7oVfccAQn3sTUpv=b=qHEX1H7abng--=0A@mail.gmail.com>
On Wed, Oct 01, 2014 at 10:11:04AM -0400, Eric Sunshine wrote:
Show 12 quoted lines
> > +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.
Show 7 quoted lines
> > +       {
> > +               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
Previous: René Scharfe
Message 9 of 9 in “sha1-array: add test-sha1-array and basic tests”
  1. 1/2 sha1-array: add test-sha1-array and basic testsRené Scharfe, Oct 1, 2014
  2. 2/2 sha1-lookup: fix handling of duplicates in sha1_pos()René Scharfe, Oct 1, 2014
  3. Jeff KingOct 1, 2014
  4. René ScharfeOct 1, 2014
  5. Jeff KingOct 1, 2014
  6. Eric SunshineOct 1, 2014
  7. Eric SunshineOct 1, 2014
  8. René ScharfeOct 1, 2014
  9. Jeff KingOct 1, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.