]> git.ipfire.org Git - thirdparty/git.git/blobdiff - submodule.c
builtin/notes: remove unnecessary free
[thirdparty/git.git] / submodule.c
index 6e14547e9e0000e6bf80e9ad21da81795cebcab7..a2b266fbfae2cd89b00a11008fbcd28bf09777e2 100644 (file)
@@ -93,7 +93,7 @@ int update_path_in_gitmodules(const char *oldpath, const char *newpath)
        if (!file_exists(GITMODULES_FILE)) /* Do nothing without .gitmodules */
                return -1;
 
-       if (is_gitmodules_unmerged(&the_index))
+       if (is_gitmodules_unmerged(the_repository->index))
                die(_("Cannot change unmerged .gitmodules, resolve merge conflicts first"));
 
        submodule = submodule_from_path(the_repository, &null_oid, oldpath);
@@ -127,7 +127,7 @@ int remove_path_from_gitmodules(const char *path)
        if (!file_exists(GITMODULES_FILE)) /* Do nothing without .gitmodules */
                return -1;
 
-       if (is_gitmodules_unmerged(&the_index))
+       if (is_gitmodules_unmerged(the_repository->index))
                die(_("Cannot change unmerged .gitmodules, resolve merge conflicts first"));
 
        submodule = submodule_from_path(the_repository, &null_oid, path);
@@ -188,7 +188,7 @@ void set_diffopt_flags_from_submodule_config(struct diff_options *diffopt,
 
                if (ignore)
                        handle_ignore_submodules_arg(diffopt, ignore);
-               else if (is_gitmodules_unmerged(&the_index))
+               else if (is_gitmodules_unmerged(the_repository->index))
                        diffopt->flags.ignore_submodules = 1;
        }
 }
@@ -258,7 +258,7 @@ int is_submodule_active(struct repository *repo, const char *path)
                }
 
                parse_pathspec(&ps, 0, 0, NULL, args.argv);
-               ret = match_pathspec(&ps, path, strlen(path), 0, NULL, 1);
+               ret = match_pathspec(repo->index, &ps, path, strlen(path), 0, NULL, 1);
 
                argv_array_clear(&args);
                clear_pathspec(&ps);
@@ -1534,18 +1534,6 @@ 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();
@@ -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: