Re: [PATCH v3 4/8] t7300: add testcase showing unnecessary traversal into ignored directory
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 10, 2021, 05:28 UTC
- Message-ID
- <xmqq7dk7rwcc.fsf@gitster.g>
- In-Reply-To
- <dc3d3f2471410aa55da4dbc8e2747192888bce5f.1620503945.git.gitgitgadget@gmail.com>
"Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 18 quoted lines
> +test_expect_failure 'avoid traversing into ignored directories' ' > + test_when_finished rm -f output error trace.* && > + test_create_repo avoid-traversing-deep-hierarchy && > + ( > + cd avoid-traversing-deep-hierarchy && > + > + mkdir -p untracked/subdir/with/a && > + >untracked/subdir/with/a/random-file.txt && > + > + GIT_TRACE2_PERF="$TRASH_DIRECTORY/trace.output" \ > + git clean -ffdxn -e untracked > + ) && > + > + grep data.*read_directo.*visited trace.output \ > + | cut -d "|" -f 9 >trace.relevant && > + cat >trace.expect <<-EOF && > + directories-visited:1 > + paths-visited:4
Are the origins of '1' and '4' trivially obvious to those who are reading the test, or do these deserve comments?
We create an empty test repository, go there and create a untracked/ hierarchy with a junk file, and tell "clean" that 'untracked' is "also" in the exclude pattern (but since there is no other exclude pattern, that is the only one), so everything underneath untracked/ we have no reason to inspect.
So, we do not visit 'untracked' directory. Which ones do we visit? Is '1' coming from the top-level of the working tree '.'? What about the number of visited paths '4' (the trace is stored outside this new test repository, so that's not it).
Thanks.
Show 5 quoted lines
> + EOF > + test_cmp trace.expect trace.relevant > +' > + > test_done