From: Junio C Hamano Date: Sat, 25 Feb 2023 23:30:07 GMT Subject: Re: [PATCH v2 00/11] Clarify API for dir.[ch] and unpack-trees.[ch] -- mark relevant fields as internal Message-ID: In-Reply-To: "Elijah Newren via GitGitGadget" writes: > Changes since v1 (thanks to Jonathan Tan for the careful reviews!) > > * Clear o->pl when freeing pl, to avoid risking use-after-free. > * Initialize o->result in update_sparsity() since it is actually used (by > check_ok_to_remove()). > > Some time ago, I noticed that struct dir_struct and struct > unpack_trees_options both have numerous fields meant for internal use only, > most of which are not marked as such. This has resulted in callers > accidentally trying to initialize some of these fields, and in at least one > case required a fair amount of review to verify other changes were okay -- > review that would have been simplified with the apriori knowledge that a > combination of multiple fields were internal-only[1]. Looking closer, I > found that only 6 out of 18 fields in dir_struct were actually meant to be > public[2], and noted that unpack_trees_options also had 11 internal-only > fields (out of 36). Nice. Will queue. Thanks.