From: Kaartic Sivaraam Date: Mon, 28 Sep 2026 09:21:08 GMT Subject: Re: [PATCH 2/7] path: introduce `safe_create_leading_directories_no_share_const()` Message-ID: <557ab7b2-a1b6-4064-997c-d0dc50126df6@gmail.com> In-Reply-To: On 9/28/26 12:45, Patrick Steinhardt wrote: > On Sat, Sep 26, 2026 at 01:19:42AM +0530, Kaartic Sivaraam wrote: >> >> nit: All other variants are mentioned in the documentation blurb just above >> the declarations. Would it also be worth mentioning this new one there? > > That's fair. I find the comment to be somewhat unwieldy overall. How > about this diff? > > diff --git a/path.h b/path.h > index 7e7408dd05..922bd6e377 100644 > --- a/path.h > +++ b/path.h > @@ -234,14 +234,11 @@ int safe_create_dir_in_gitdir(struct repository *repo, const char *path); > * race, callers might want to try invoking the function again when it > * returns SCLD_VANISHED. > * > - * safe_create_leading_directories() temporarily changes path while it > - * is working but restores it before returning. > - * safe_create_leading_directories_const() doesn't modify path, even > - * temporarily. Both these variants adjust the permissions of the > - * created directories to honor core.sharedRepository, so they are best > - * suited for files inside the git dir. For working tree files, use > - * safe_create_leading_directories_no_share() instead, as it ignores > - * the core.sharedRepository setting. > + * The default variants honor "core.sharedRepository" and temporarily modify > + * `path`. Note that this configuration should be honored for all files in the > + * git directory. The `no_share()` variants ignore "core.sharedRepository", > + * and should be used for working tree files. The `const()` variants do not > + * modify `path`. > */ Reads much better to me. Thanks. -- Sivaraam