On Fri, Jun 28, 2019 at 5:39 AM Jeff King <peff@xxxxxxxx> wrote: > [...] > For bulk creation, we can do much better by using fast-import, but it's > often a pain to generate the input. Let's provide a helper to do so. > [...] > Signed-off-by: Jeff King <peff@xxxxxxxx> > --- > diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh > @@ -233,6 +233,137 @@ test_merge () { > +# Similar to test_commit, but efficiently create <nr> commits, each with a > +# unique number $n (from 1 to <nr> by default) in the commit message. > +# > +# Usage: test_commit_bulk [options] <nr> > +# [...] > +# > +# The message, filename, and contents strings are evaluated by the shell inside > +# double-quotes, with $n set to the current commit number. So you can do: > +# > +# test_commit_bulk --filename=file --contents='modification $n' Considering that test_commit_bulk() is intended to be used within a test body, and considering that test bodies are almost always encapsulated in single quotes, recommending single quoting the value of --contents= seems contraindicated. Double quotes likely would be better. > +# to have every commit touch the same file, but with unique content. Spaces are > +# OK, but you must escape any metacharacters (like backslashes or > +# double-quotes) you do not want expanded. > +# > +test_commit_bulk () { > + [...] > + in_dir=${indir:+-C "$indir"} Doesn't this suffer the problem in which some older/broken shells[1][2][3][4] incorrectly expand this to: "-C <dir>" rather than the expected: -C "<dir>" ? Is this something we still care about? Same comment applies to other instances of ${indir:+-C "$indir"} below. [1]: http://public-inbox.org/git/20160517215214.GA16905@xxxxxxxxxxxxxxxxxxxxx/ [2]: http://public-inbox.org/git/e3bfc53363b14826d828e1adffbbeea@74d39fa044aa309eaea14b9f57fe79c/ [3]: http://public-inbox.org/git/20160518010609.Horde.sM8QUFek6WMAAwho56DDob8@xxxxxxxxxxxxxxxxxxxxxxxxxx/ [4]: http://public-inbox.org/git/1240044459-57227-1-git-send-email-ben@xxxxxxx/