diff options
author | Stefan Beller <sbeller@google.com> | 2018-06-19 02:06:07 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-06-19 18:28:13 +0200 |
commit | e98317508c02b7cc65bf5b28f27788e47096b166 (patch) | |
tree | 49f33af085e1af8f0c3e5f7c772c2515d2741f57 /builtin/submodule--helper.c | |
parent | submodule: unset core.worktree if no working tree is present (diff) | |
download | git-e98317508c02b7cc65bf5b28f27788e47096b166.tar.xz git-e98317508c02b7cc65bf5b28f27788e47096b166.zip |
submodule: ensure core.worktree is set after update
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/submodule--helper.c')
-rw-r--r-- | builtin/submodule--helper.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index bd250ca216..dffc55ed8e 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -1860,6 +1860,29 @@ static int check_name(int argc, const char **argv, const char *prefix) return 0; } +static int connect_gitdir_workingtree(int argc, const char **argv, const char *prefix) +{ + struct strbuf sb = STRBUF_INIT; + const char *name, *path; + char *sm_gitdir; + + if (argc != 3) + BUG("submodule--helper connect-gitdir-workingtree <name> <path>"); + + name = argv[1]; + path = argv[2]; + + strbuf_addf(&sb, "%s/modules/%s", get_git_dir(), name); + sm_gitdir = absolute_pathdup(sb.buf); + + connect_work_tree_and_git_dir(path, sm_gitdir, 0); + + strbuf_release(&sb); + free(sm_gitdir); + + return 0; +} + #define SUPPORT_SUPER_PREFIX (1<<0) struct cmd_struct { @@ -1873,6 +1896,7 @@ static struct cmd_struct commands[] = { {"name", module_name, 0}, {"clone", module_clone, 0}, {"update-clone", update_clone, 0}, + {"connect-gitdir-workingtree", connect_gitdir_workingtree, 0}, {"relative-path", resolve_relative_path, 0}, {"resolve-relative-url", resolve_relative_url, 0}, {"resolve-relative-url-test", resolve_relative_url_test, 0}, |