Re: [PATCH 2/2] builtin/repack.c: avoid dir traversal in `collect_pack_filenames()`
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 10, 2023, 21:35 UTC
- Message-ID
- <xmqqa5w34fhk.fsf@gitster.g>
- In-Reply-To
- <b3d0d9308ef1a0aab8dd5a65354044568c65388b.1689017830.git.me@ttaylorr.com>
Taylor Blau <me@ttaylorr.com> writes:
Show 5 quoted lines
> However, manually enumerating a repository's packs via `readdir()` is > confusing and error-prone. It leads to frustrating inconsistencies > between which packs Git considers to be part of a repository (i.e., > could be found in the list of packs from `get_all_packs()`), and which > packs `collect_pack_filenames()` considers to meet the same criteria.
Makes sense.
> One gotcha here is that we have to ignore non-local packs, since the > original version of `collect_pack_filenames()` only looks at the local > pack directory to collect existing packs.
Yup.
Does this "fix" anything, or just makes the resulting code clearer and protects it from future breakage? I think it is the latter and not having any test is justified.
Thanks.