Re: [PATCH 1/6] test-lib: introduce test_commit_bulk
- From
SZEDER Gábor <szeder.dev@gmail.com>
- Date
- Jun 28, 2019, 23:04 UTC
- Message-ID
- <20190628230417.GC21574@szeder.dev>
- In-Reply-To
- <CAPig+cQAKVOqYH-CcqzViP_zuKwg5fWO2_i8=Z5t=BVf9uoAXQ@mail.gmail.com>
On Fri, Jun 28, 2019 at 05:32:35PM -0400, Eric Sunshine wrote:
> On Fri, Jun 28, 2019 at 5:39 AM Jeff King <peff@peff.net> wrote:
Show 20 quoted lines
> > +# 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.I think we don't need any of those "${indir:+-C "$indir"}" parameter expansions and could simply use 'git -C "$indir" cmd...' everywhere. $indir is set to empty right at the start of the function, and 'git -C "" ...' works and doesn't change the working directory.