Re: [PATCH v2] remote helpers: avoid blind fall-back to ".git" when setting GIT_DIR
- From
Jeff King <peff@peff.net>
- Date
- Dec 30, 2016, 00:49 UTC
- Message-ID
- <20161230004944.pkblwpxwkacpk7dd@sigill.intra.peff.net>
- In-Reply-To
- <CAGZ79kZiR7grGeMrMFRuQQ0kW6eQ4m=ZizGHDbT-s14iAj8hWQ@mail.gmail.com>
On Thu, Dec 29, 2016 at 04:37:30PM -0800, Stefan Beller wrote:
Show 17 quoted lines
> > + mkdir lsremote-root && > > + ( > > + GIT_CEILING_DIRECTORIES=$(pwd) && > > + export GIT_CEILING_DIRECTORIES && > > + cd lsremote-root && > > + git ls-remote "$HTTPD_URL/smart/repo.git" >../actual > > + ) && > > We could avoid the subshell via > > GIT_CEILING_DIRECTORIES=$(pwd) \ > git -C lsremote-root lsremote ... >actual > > Not sure if it is worth to trade off a block of code (and an extra shell > at run time) for an overly long line. > > The rest looks good to me.
I mentioned elsewhere that we now have a "nongit" function to do this as a one-liner. It might be worth applying your optimization to that function, so it would take effect in may places.
-Peff