Skip to content

Commit 25e7659

Browse files
committed
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 Signed-off-by: Haihua Yang <yanghh@gmail.com> Signed-off-by: Haihua Yang <yanghh@gmail.com>
1 parent 1fa6894 commit 25e7659

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

builtin/submodule--helper.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2519,7 +2519,12 @@ static int ensure_core_worktree(const char *path)
25192519
const char *rel_path;
25202520
struct strbuf sb = STRBUF_INIT;
25212521

2522-
cfg_file = repo_git_path(&subrepo, "config");
2522+
/* Use config.worktree if it exists, otherwise use config */
2523+
cfg_file = repo_git_path(&subrepo, "config.worktree");
2524+
if (access(cfg_file, F_OK) != 0) {
2525+
free(cfg_file);
2526+
cfg_file = repo_git_path(&subrepo, "config");
2527+
}
25232528

25242529
abs_path = absolute_pathdup(path);
25252530
rel_path = relative_path(abs_path, subrepo.gitdir, &sb);

0 commit comments

Comments
 (0)