Re: [PATCH 4/7] t0027: optimize how we reset repository state
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Nov 9, 2026, 06:30 UTC
- Message-ID
- <avFofjtc-1oXIPrB@pks.im>
- In-Reply-To
- <20261108164901.GA29213@tb-raspi4>
On Sun, Nov 08, 2026 at 05:49:01PM +0100, Torsten Bögershausen wrote:
Show 30 quoted lines
> On Fri, Nov 06, 2026 at 09:33:01AM -0800, Junio C Hamano wrote:
> > Hmph, don't we want avoid hand-expand the list of files even though
> > we may want to use one "rm -f" and another "git checkout" command
> > to work on them? IOW,
> >
> > paths=
> > for f in LF CRLF LF_mix_CR CRLF_mix_LF LF_nul
> > do
> > paths=${paths:+"$paths "}crlf_false_attr__$f.txt
> > done
> > test_expect_success "setup checkout ${ceol:+ with -c core.eol=$ceol}" '
> > rm -f $paths &&
> > git ${ceol:+-c core.eol=$ceol} checkout -- $paths
> > '
>
> "Wow, so it can go" - a well working, but slow code is speed up so much.
>
> I used the following (before reading the suggestion from Junio)
> and the execution time here on an older MacOs dropped from 71 seconds to 54 seconds.
>
> test_expect_success "setup file checkout ${ceol:+ with -c core.eol=$ceol}" '
> files="\
> crlf_false_attr__LF.txt \
> crlf_false_attr__CRLF.txt \
> crlf_false_attr__LF_mix_CR.txt \
> crlf_false_attr__CRLF_mix_LF.txt \
> crlf_false_attr__LF_nul.txt" &&
> rm -fv $files &&
> git ${ceol:+-c core.eol=$ceol} checkout -- $files
> 'Hmm. I think I like Junio's alternative a bit better, but both are definitely an improvement over my take. Will add to the next version, thanks.
Patrick