submodule: convert stage_updated_gitmodules to take a struct index_state

Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Brandon Williams committed Dec 12, 2017 at 11:53 UTC 3b8317a9e6f1538c99074eeffd4b27ac18de5648
4 files changed +5 -5
builtin/mv.c
+1 -1
@@ -291,7 +291,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
291 }
292
293 if (gitmodules_modified)
294 - stage_updated_gitmodules();
294 + stage_updated_gitmodules(&the_index);
295
296 if (active_cache_changed &&
297 write_locked_index(&the_index, &lock_file, COMMIT_LOCK))
builtin/rm.c
+1 -1
@@ -382,7 +382,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
382 }
383 strbuf_release(&buf);
384 if (gitmodules_modified)
385 - stage_updated_gitmodules();
385 + stage_updated_gitmodules(&the_index);
386 }
387
388 if (active_cache_changed) {
submodule.c
+2 -2
@@ -143,9 +143,9 @@ int remove_path_from_gitmodules(const char *path)
143 return 0;
144 }
145
146 -void stage_updated_gitmodules(void)
146 +void stage_updated_gitmodules(struct index_state *istate)
147 {
148 - if (add_file_to_cache(GITMODULES_FILE, 0))
148 + if (add_file_to_index(istate, GITMODULES_FILE, 0))
149 die(_("staging updated .gitmodules failed"));
150 }
151
submodule.h
+1 -1
@@ -37,7 +37,7 @@ extern int is_gitmodules_unmerged(const struct index_state *istate);
37 extern int is_staging_gitmodules_ok(const struct index_state *istate);
38 extern int update_path_in_gitmodules(const char *oldpath, const char *newpath);
39 extern int remove_path_from_gitmodules(const char *path);
40 -extern void stage_updated_gitmodules(void);
40 +extern void stage_updated_gitmodules(struct index_state *istate);
41 extern void set_diffopt_flags_from_submodule_config(struct diff_options *,
42 const char *path);
43 extern int git_default_submodule_config(const char *var, const char *value, void *cb);