Re: [PATCH 1/6] test-lib: introduce test_commit_bulk
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Jun 28, 2019, 23:46 UTC
- Message-ID
- <CAPig+cQnvotvJakCp1ic_WP3AMojNmfZw-PoinR=VOODmtNBtw@mail.gmail.com>
- In-Reply-To
- <20190628230417.GC21574@szeder.dev>
On Fri, Jun 28, 2019 at 7:04 PM SZEDER Gábor <szeder.dev@gmail.com> wrote:
Show 11 quoted lines
> 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:
> > > + in_dir=${indir:+-C "$indir"}
> >
> > Doesn't this suffer the problem in which some older/broken
> > shells[1][2][3][4] incorrectly [...]
>
> 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.I recall the discussion around the meaning of `-C ""` when that command line option was introduced. The conclusion was that the zero-length argument should mean "this directory" since that's how `cd ""` behaves. However, I don't think that behavior ever got documented, and it's not necessarily obvious. An alternative would be to default 'indir' to ".", which should give the same result and be easily understood.