Skip to content

Commit 3b8317a

Browse files
bmwillgitster
authored andcommitted
submodule: convert stage_updated_gitmodules to take a struct index_state
Signed-off-by: Brandon Williams <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 95ec6b1 commit 3b8317a

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

builtin/mv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
291291
}
292292

293293
if (gitmodules_modified)
294-
stage_updated_gitmodules();
294+
stage_updated_gitmodules(&the_index);
295295

296296
if (active_cache_changed &&
297297
write_locked_index(&the_index, &lock_file, COMMIT_LOCK))

builtin/rm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
382382
}
383383
strbuf_release(&buf);
384384
if (gitmodules_modified)
385-
stage_updated_gitmodules();
385+
stage_updated_gitmodules(&the_index);
386386
}
387387

388388
if (active_cache_changed) {

submodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,9 @@ int remove_path_from_gitmodules(const char *path)
143143
return 0;
144144
}
145145

146-
void stage_updated_gitmodules(void)
146+
void stage_updated_gitmodules(struct index_state *istate)
147147
{
148-
if (add_file_to_cache(GITMODULES_FILE, 0))
148+
if (add_file_to_index(istate, GITMODULES_FILE, 0))
149149
die(_("staging updated .gitmodules failed"));
150150
}
151151

submodule.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ extern int is_gitmodules_unmerged(const struct index_state *istate);
3737
extern int is_staging_gitmodules_ok(const struct index_state *istate);
3838
extern int update_path_in_gitmodules(const char *oldpath, const char *newpath);
3939
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);
4141
extern void set_diffopt_flags_from_submodule_config(struct diff_options *,
4242
const char *path);
4343
extern int git_default_submodule_config(const char *var, const char *value, void *cb);

0 commit comments

Comments
 (0)