From: "haihuayang via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: haihuayang <yanghh@gmail.com>, Haihua Yang <yanghh@gmail.com>
Subject: [PATCH] update worktree in config.worktree if it exists
Date: Thu, 28 Aug 2025 16:12:19 +0000 [thread overview]
Message-ID: <pull.2035.git.git.1756397539285.gitgitgadget@gmail.com> (raw)
From: Haihua Yang <yanghh@gmail.com>
When updating submodule core.worktree configuration
- If config.worktree exists in the submodule's gitdir, write to that file
- Otherwise, write to the commondir/config file
Signed-off-by: Haihua Yang <yanghh@gmail.com>
Signed-off-by: Haihua Yang <yanghh@gmail.com>
---
update worktree in config.worktree if it exists
When updating submodule core.worktree configuration
* If config.worktree exists in the submodule's gitdir, write to that
file
* Otherwise, write to the commondir/config file
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2035%2Fhaihuayang%2Fmaster-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2035/haihuayang/master-v1
Pull-Request: https://github.com/git/git/pull/2035
builtin/submodule--helper.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 07a1935cbe..231c70f12e 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -2519,7 +2519,12 @@ static int ensure_core_worktree(const char *path)
const char *rel_path;
struct strbuf sb = STRBUF_INIT;
- cfg_file = repo_git_path(&subrepo, "config");
+ /* Use config.worktree if it exists, otherwise use config */
+ cfg_file = repo_git_path(&subrepo, "config.worktree");
+ if (access(cfg_file, F_OK) != 0) {
+ free(cfg_file);
+ cfg_file = repo_git_path(&subrepo, "config");
+ }
abs_path = absolute_pathdup(path);
rel_path = relative_path(abs_path, subrepo.gitdir, &sb);
base-commit: 1fa68948c3d76328236cac73d2adf33c905bd8e3
--
gitgitgadget
reply other threads:[~2025-08-28 16:12 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=pull.2035.git.git.1756397539285.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=git@vger.kernel.org \
--cc=yanghh@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;
as well as URLs for NNTP newsgroup(s).