From 3b8317a9e6f1538c99074eeffd4b27ac18de5648 Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Tue, 12 Dec 2017 11:53:50 -0800 Subject: [PATCH] submodule: convert stage_updated_gitmodules to take a struct index_state Signed-off-by: Brandon Williams Signed-off-by: Junio C Hamano --- builtin/mv.c | 2 +- builtin/rm.c | 2 +- submodule.c | 4 ++-- submodule.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/builtin/mv.c b/builtin/mv.c index ffdd5f01a1..cf3684d907 100644 --- a/builtin/mv.c +++ b/builtin/mv.c @@ -291,7 +291,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix) } if (gitmodules_modified) - stage_updated_gitmodules(); + stage_updated_gitmodules(&the_index); if (active_cache_changed && write_locked_index(&the_index, &lock_file, COMMIT_LOCK)) diff --git a/builtin/rm.c b/builtin/rm.c index d91451fea1..4a2fcca27b 100644 --- a/builtin/rm.c +++ b/builtin/rm.c @@ -382,7 +382,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix) } strbuf_release(&buf); if (gitmodules_modified) - stage_updated_gitmodules(); + stage_updated_gitmodules(&the_index); } if (active_cache_changed) { diff --git a/submodule.c b/submodule.c index 95e6aff2bb..7097be806e 100644 --- a/submodule.c +++ b/submodule.c @@ -143,9 +143,9 @@ int remove_path_from_gitmodules(const char *path) return 0; } -void stage_updated_gitmodules(void) +void stage_updated_gitmodules(struct index_state *istate) { - if (add_file_to_cache(GITMODULES_FILE, 0)) + if (add_file_to_index(istate, GITMODULES_FILE, 0)) die(_("staging updated .gitmodules failed")); } diff --git a/submodule.h b/submodule.h index f0da0277a4..cd984ecba1 100644 --- a/submodule.h +++ b/submodule.h @@ -37,7 +37,7 @@ extern int is_gitmodules_unmerged(const struct index_state *istate); extern int is_staging_gitmodules_ok(const struct index_state *istate); extern int update_path_in_gitmodules(const char *oldpath, const char *newpath); extern int remove_path_from_gitmodules(const char *path); -extern void stage_updated_gitmodules(void); +extern void stage_updated_gitmodules(struct index_state *istate); extern void set_diffopt_flags_from_submodule_config(struct diff_options *, const char *path); extern int git_default_submodule_config(const char *var, const char *value, void *cb); -- 2.47.1