Merge branch 'jn/submodule-core-worktree-revert'
authorJunio C Hamano <gitster@pobox.com>
Mon, 10 Sep 2018 17:38:58 +0000 (10:38 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 10 Sep 2018 17:38:58 +0000 (10:38 -0700)
* jn/submodule-core-worktree-revert:
Revert "Merge branch 'sb/submodule-core-worktree'"

builtin/submodule--helper.c
git-submodule.sh
submodule.c
submodule.h
t/lib-submodule-update.sh
t/t7400-submodule-basic.sh
index b56028ba9d9717407c959e0cf0c6597f49779ab1..f6fb8991f3a81b0b2dd895c1e8550b5bda5ea99a 100644 (file)
@@ -1123,8 +1123,6 @@ static void deinit_submodule(const char *path, const char *prefix,
                if (!(flags & OPT_QUIET))
                        printf(format, displaypath);
 
-               submodule_unset_core_worktree(sub);
-
                strbuf_release(&sb_rm);
        }
 
@@ -2005,29 +2003,6 @@ 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 {
@@ -2041,7 +2016,6 @@ 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},
index f7fd80345cd991df4b17c6598d7dd7bd462424c7..1cb2c0a31b416f9db979cb86badac5f958792453 100755 (executable)
@@ -580,11 +580,6 @@ cmd_update()
                        die "$(eval_gettext "Unable to find current \${remote_name}/\${branch} revision in submodule path '\$sm_path'")"
                fi
 
-               if ! $(git config -f "$(git rev-parse --git-common-dir)/modules/$name/config" core.worktree) 2>/dev/null
-               then
-                       git submodule--helper connect-gitdir-workingtree "$name" "$sm_path"
-               fi
-
                if test "$subsha1" != "$sha1" || test -n "$force"
                then
                        subforce=$force
index 50cbf5f13ed84c5da081b4130bbd50b7b97e3121..a2b266fbfae2cd89b00a11008fbcd28bf09777e2 100644 (file)
@@ -1534,18 +1534,6 @@ int bad_to_remove_submodule(const char *path, unsigned flags)
        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();
@@ -1711,8 +1699,6 @@ int submodule_move_head(const char *path,
 
                        if (is_empty_dir(path))
                                rmdir_or_warn(path);
-
-                       submodule_unset_core_worktree(sub);
                }
        }
 out:
index 7d476cefa7eea0c183bf515a6f48f1fa27ca8b25..e452919aa467413107ea749fe90b17e4e3e198c4 100644 (file)
@@ -127,8 +127,6 @@ int submodule_move_head(const char *path,
                        const char *new_head,
                        unsigned flags);
 
-void submodule_unset_core_worktree(const struct submodule *sub);
-
 /*
  * Prepare the "env_array" parameter of a "struct child_process" for executing
  * a submodule by clearing any repo-specific environment variables, but
index 5b56b23166bb3dea2e89cea38a19eb5698dfff53..016391723c09491e53ebf4e0b69972783c7bc491 100755 (executable)
@@ -235,7 +235,7 @@ reset_work_tree_to_interested () {
        then
                mkdir -p submodule_update/.git/modules/sub1/modules &&
                cp -r submodule_update_repo/.git/modules/sub1/modules/sub2 submodule_update/.git/modules/sub1/modules/sub2
-               # core.worktree is unset for sub2 as it is not checked out
+               GIT_WORK_TREE=. git -C submodule_update/.git/modules/sub1/modules/sub2 config --unset core.worktree
        fi &&
        # indicate we are interested in the submodule:
        git -C submodule_update config submodule.sub1.url "bogus" &&
@@ -709,8 +709,7 @@ test_submodule_recursing_with_args_common() {
                        git branch -t remove_sub1 origin/remove_sub1 &&
                        $command remove_sub1 &&
                        test_superproject_content origin/remove_sub1 &&
-                       ! test -e sub1 &&
-                       test_must_fail git config -f .git/modules/sub1/config core.worktree
+                       ! test -e sub1
                )
        '
        # ... absorbing a .git directory along the way.
index 7d3d9842108ae5961f7c17e392f0ce9a8b397cf4..c0ffc1022aedf1e7248388bdca06d071108c3b61 100755 (executable)
@@ -984,11 +984,6 @@ test_expect_success 'submodule deinit should remove the whole submodule section
        rmdir init
 '
 
-test_expect_success 'submodule deinit should unset core.worktree' '
-       test_path_is_file .git/modules/example/config &&
-       test_must_fail git config -f .git/modules/example/config core.worktree
-'
-
 test_expect_success 'submodule deinit from subdirectory' '
        git submodule update --init &&
        git config submodule.example.foo bar &&