submodule.c: use the right index instead of the_index

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nguyễn Thái Ngọc Duy committed Aug 13, 2018 at 18:14 UTC 68f08b4b235d09a95604c6bc8349208b37a2f41e
1 file changed +4 -4
submodule.c
+4 -4
@@ -93,7 +93,7 @@ int update_path_in_gitmodules(const char *oldpath, const char *newpath)
93 if (!file_exists(GITMODULES_FILE)) /* Do nothing without .gitmodules */
94 return -1;
95
96 - if (is_gitmodules_unmerged(&the_index))
96 + if (is_gitmodules_unmerged(the_repository->index))
97 die(_("Cannot change unmerged .gitmodules, resolve merge conflicts first"));
98
99 submodule = submodule_from_path(the_repository, &null_oid, oldpath);
@@ -127,7 +127,7 @@ int remove_path_from_gitmodules(const char *path)
127 if (!file_exists(GITMODULES_FILE)) /* Do nothing without .gitmodules */
128 return -1;
129
130 - if (is_gitmodules_unmerged(&the_index))
130 + if (is_gitmodules_unmerged(the_repository->index))
131 die(_("Cannot change unmerged .gitmodules, resolve merge conflicts first"));
132
133 submodule = submodule_from_path(the_repository, &null_oid, path);
@@ -188,7 +188,7 @@ void set_diffopt_flags_from_submodule_config(struct diff_options *diffopt,
188
189 if (ignore)
190 handle_ignore_submodules_arg(diffopt, ignore);
191 - else if (is_gitmodules_unmerged(&the_index))
191 + else if (is_gitmodules_unmerged(the_repository->index))
192 diffopt->flags.ignore_submodules = 1;
193 }
194 }
@@ -258,7 +258,7 @@ int is_submodule_active(struct repository *repo, const char *path)
258 }
259
260 parse_pathspec(&ps, 0, 0, NULL, args.argv);
261 - ret = match_pathspec(&the_index, &ps, path, strlen(path), 0, NULL, 1);
261 + ret = match_pathspec(repo->index, &ps, path, strlen(path), 0, NULL, 1);
262
263 argv_array_clear(&args);
264 clear_pathspec(&ps);