submodule: convert stage_updated_gitmodules to take a struct index_state
authorBrandon Williams <bmwill@google.com>
Tue, 12 Dec 2017 19:53:50 +0000 (11:53 -0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 12 Dec 2017 20:35:20 +0000 (12:35 -0800)
Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/mv.c
builtin/rm.c
submodule.c
submodule.h
index ffdd5f01a190b99407d1019972e3198c42b7194c..cf3684d907a2fe3408581502c682d6290c790827 100644 (file)
@@ -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))
index d91451fea122cec3923543ef78acf0c5ef4c5fa2..4a2fcca27b3f722ca520c2411b80e6984ecf780a 100644 (file)
@@ -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) {
index 95e6aff2bb74e1374d22997d1918ed190c6edafc..7097be806e237445f92223c6830ca7c6d38cb27e 100644 (file)
@@ -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"));
 }
 
index f0da0277a45b49369d89cebdd4d30f44bef23d3d..cd984ecba158563b6dc41c57b60dcf40941b4c4f 100644 (file)
@@ -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);