Git development
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/7] path: introduce `safe_create_leading_directories_no_share_const()`
Date: Mon, 28 Sep 2026 09:15:56 +0200	[thread overview]
Message-ID: <aroULK79T-UkwkoM@pks.im> (raw)
In-Reply-To: <4770b19f-9a8d-4a4c-8cc6-745aa2868b94@gmail.com>

On Sat, Sep 26, 2026 at 01:19:42AM +0530, Kaartic Sivaraam wrote:
> On 9/24/26 14:49, Patrick Steinhardt wrote:
> > 
> > diff --git a/path.h b/path.h
> > index 7e7408dd05..e2d62c4978 100644
> > --- a/path.h
> > +++ b/path.h
> > @@ -254,6 +254,7 @@ enum scld_error safe_create_leading_directories(struct repository *repo, char *p
> >   enum scld_error safe_create_leading_directories_const(struct repository *repo,
> >   						      const char *path);
> >   enum scld_error safe_create_leading_directories_no_share(char *path);
> > +enum scld_error safe_create_leading_directories_no_share_const(const char *path);
> > 
> 
> 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`.
  */
 enum scld_error {
        SCLD_OK = 0,

Patrick

  reply	other threads:[~2026-09-28  7:16 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-24  9:19 [PATCH 0/7] setup: enforce repo passed to `create_repository()` has no state Patrick Steinhardt
2026-09-24  9:19 ` [PATCH 1/7] path: drop useless `safe_create_leading_directories_1()` Patrick Steinhardt
2026-09-28  9:01   ` Karthik Nayak
2026-09-24  9:19 ` [PATCH 2/7] path: introduce `safe_create_leading_directories_no_share_const()` Patrick Steinhardt
2026-09-25 19:49   ` Kaartic Sivaraam
2026-09-28  7:15     ` Patrick Steinhardt [this message]
2026-09-28  9:21       ` Kaartic Sivaraam
2026-09-24  9:19 ` [PATCH 3/7] builtin/init: refactor messy creation of leading directories Patrick Steinhardt
2026-09-25 20:21   ` Kaartic Sivaraam
2026-09-24  9:19 ` [PATCH 4/7] builtin/init: move handling of "core.sharedRepository" into "setup.c" Patrick Steinhardt
2026-09-25 20:54   ` Kaartic Sivaraam
2026-09-28  9:13   ` Karthik Nayak
2026-09-24  9:19 ` [PATCH 5/7] builtin/clone: don't apply "core.sharedRepository" to leading dirs Patrick Steinhardt
2026-09-24  9:19 ` [PATCH 6/7] repository: adapt `repo_clear()` to fully reset the repository Patrick Steinhardt
2026-09-28  9:18   ` Karthik Nayak
2026-09-28  9:52     ` Patrick Steinhardt
2026-09-24  9:19 ` [PATCH 7/7] setup: enforce that passed-in repo does not carry relevant state Patrick Steinhardt
2026-09-25 21:08 ` [PATCH 0/7] setup: enforce repo passed to `create_repository()` has no state Kaartic Sivaraam
2026-09-28  9:20 ` Karthik Nayak
2026-09-28  9:51 ` [PATCH v2 " Patrick Steinhardt
2026-09-28  9:51   ` [PATCH v2 1/7] path: drop useless `safe_create_leading_directories_1()` Patrick Steinhardt
2026-09-28  9:51   ` [PATCH v2 2/7] path: introduce `safe_create_leading_directories_no_share_const()` Patrick Steinhardt
2026-09-28  9:51   ` [PATCH v2 3/7] builtin/init: refactor messy creation of leading directories Patrick Steinhardt
2026-09-28  9:51   ` [PATCH v2 4/7] builtin/init: move handling of "core.sharedRepository" into "setup.c" Patrick Steinhardt
2026-09-28  9:51   ` [PATCH v2 5/7] builtin/clone: don't apply "core.sharedRepository" to leading dirs Patrick Steinhardt
2026-09-28  9:51   ` [PATCH v2 6/7] repository: adapt `repo_clear()` to fully reset the repository Patrick Steinhardt
2026-09-28  9:51   ` [PATCH v2 7/7] setup: enforce that passed-in repo does not carry relevant state Patrick Steinhardt
2026-09-28 12:15   ` [PATCH v2 0/7] setup: enforce repo passed to `create_repository()` has no state Kaartic Sivaraam
2026-09-28 12:19     ` Kaartic Sivaraam
2026-09-28 12:48       ` Patrick Steinhardt
2026-09-28 15:59         ` Junio C Hamano
2026-09-28 12:48     ` Patrick Steinhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aroULK79T-UkwkoM@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=kaartic.sivaraam@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox