summaryrefslogtreecommitdiff
path: root/submodule.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-07-18 19:20:28 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-07-18 19:20:28 (GMT)
commit7e25437d35a70791b345872af202eabfb3e1a8bc (patch)
tree1d8dcdc9814e310d8be656b11d76885c37191185 /submodule.c
parent00624d608cc69bd62801c93e74d1ea7a7ddd6598 (diff)
parent984cd77ddbf0eea7371a18ad7124120473b6bb2d (diff)
downloadgit-7e25437d35a70791b345872af202eabfb3e1a8bc.zip
git-7e25437d35a70791b345872af202eabfb3e1a8bc.tar.gz
git-7e25437d35a70791b345872af202eabfb3e1a8bc.tar.bz2
Merge branch 'sb/submodule-core-worktree'
"git submodule" did not correctly adjust core.worktree setting that indicates whether/where a submodule repository has its associated working tree across various state transitions, which has been corrected. * sb/submodule-core-worktree: submodule deinit: unset core.worktree submodule: ensure core.worktree is set after update submodule: unset core.worktree if no working tree is present
Diffstat (limited to 'submodule.c')
-rw-r--r--submodule.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/submodule.c b/submodule.c
index 0998ea2..d3a9aab 100644
--- a/submodule.c
+++ b/submodule.c
@@ -1534,6 +1534,18 @@ out:
return ret;
}
+void submodule_unset_core_worktree(const struct submodule *sub)
+{
+ char *config_path = xstrfmt("%s/modules/%s/config",
+ get_git_common_dir(), sub->name);
+
+ if (git_config_set_in_file_gently(config_path, "core.worktree", NULL))
+ warning(_("Could not unset core.worktree setting in submodule '%s'"),
+ sub->path);
+
+ free(config_path);
+}
+
static const char *get_super_prefix_or_empty(void)
{
const char *s = get_super_prefix();
@@ -1699,6 +1711,8 @@ int submodule_move_head(const char *path,
if (is_empty_dir(path))
rmdir_or_warn(path);
+
+ submodule_unset_core_worktree(sub);
}
}
out: