Re: [PATCH 4/7] t0027: optimize how we reset repository state
- From
Torsten Bögershausen <tboegi@web.de>
- Date
- Nov 8, 2026, 16:49 UTC
- Message-ID
- <20261108164901.GA29213@tb-raspi4>
- In-Reply-To
- <xmqqv769kgqa.fsf@gitster.g>
On Fri, Nov 06, 2026 at 09:33:01AM -0800, Junio C Hamano wrote:
Show 13 quoted lines
> 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
'