From: Patrick Steinhardt Date: Mon, 28 Sep 2026 12:48:08 GMT Subject: Re: [PATCH v2 0/7] setup: enforce repo passed to `create_repository()` has no state Message-ID: In-Reply-To: On Mon, Sep 28, 2026 at 05:45:00PM +0530, Kaartic Sivaraam wrote: > On 9/28/26 15:21, Patrick Steinhardt wrote: > > > > [... snip ...] > > > > 3: 3a7c197f1b = 3: 8dd89f144a builtin/init: refactor messy creation of leading directories > > 4: c3ced666bd = 4: f37db1b17d builtin/init: move handling of "core.sharedRepository" into "setup.c" > > 5: 25918a4ff6 = 5: db76d32f2c builtin/clone: don't apply "core.sharedRepository" to leading dirs > > 6: a742852675 ! 6: 19388a188c repository: adapt `repo_clear()` to fully reset the repository > > @@ Commit message > > some state because we don't make sure to clear the whole structure. > > Refactor the function to set the whole repository to all-zeroes to avoid > > - any kind of leaking state. While at it, make it a bit more robust when > > - called on an already-blank repository. > > + any kind of leaking state. Replace calls of `FREE_AND_NULL()` to instead > > + use free(3p) to avoid zeroing out the data twice. > > > > s/free(3p)/free/ > Rest of the inter-diff looks neat. The "(3p)" is intentional, as we use that to refer to man pages. In this case, it's free as specified in the POSIX programmer's manual. Thanks! Patrick