Re: [PATCH] test-lib: fix "$remove_trash" regression and match_pattern_list() bugs
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 17, 2021, 00:36 UTC
- Message-ID
- <xmqqh7hxnx7v.fsf@gitster.g>
- In-Reply-To
- <87pmwmxd6f.fsf@evledraar.gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 7 quoted lines
>> Whatever the expansion mechanism, I do think it's worth having callers >> quote "$GIT_SKIP_TESTS" and then performing the expansion within >> match_pattern_list. Then the nasty mechanics are all in that one place. > > I think it's rather clean to not quote it, i.e. to have the loop get a > list of item and then things to match, it would also make it easier to > e.g. port it to a native C program.
Sorry, I am not sure how it can work without quoting $GIT_SKIP_TESTS and exposing the details of how we disable globbing when the caller calls match_pattern_list.
A list of item in $GIT_SKIP_TESTS would not be able to pass t?000 in it intact to the loop that processes each of the item on the list.
for pattern in $GIT_SKIP_TESTS do attempt to match with $pattern done
will see t5000 in $pattern due to globbing. It's not like "$@" trick can be applied to any plain variable.