Skip to content

Commit 7da9aba

Browse files
bmwillgitster
authored andcommitted
submodule: used correct index in is_staging_gitmodules_ok
Commit 883e248 (fsmonitor: teach git to optionally utilize a file system monitor to speed up detecting new or changed files., 2017-09-22) introduced a call to 'ce_match_stat()' in 'is_staging_gitmodules_ok()' which implicitly relys on the the global 'the_index' instead of the passed in 'struct index_state'. Fix this by changing the call to 'ie_match_stat()' and using the passed in index_state struct. Signed-off-by: Brandon Williams <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3b8317a commit 7da9aba

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

submodule.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,15 @@ int is_gitmodules_unmerged(const struct index_state *istate)
5555
* future version when we learn to stage the changes we do ourselves without
5656
* staging any previous modifications.
5757
*/
58-
int is_staging_gitmodules_ok(const struct index_state *istate)
58+
int is_staging_gitmodules_ok(struct index_state *istate)
5959
{
6060
int pos = index_name_pos(istate, GITMODULES_FILE, strlen(GITMODULES_FILE));
6161

6262
if ((pos >= 0) && (pos < istate->cache_nr)) {
6363
struct stat st;
6464
if (lstat(GITMODULES_FILE, &st) == 0 &&
65-
ce_match_stat(istate->cache[pos], &st, CE_MATCH_IGNORE_FSMONITOR) & DATA_CHANGED)
65+
ie_match_stat(istate, istate->cache[pos], &st,
66+
CE_MATCH_IGNORE_FSMONITOR) & DATA_CHANGED)
6667
return 0;
6768
}
6869

submodule.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ struct submodule_update_strategy {
3434
#define SUBMODULE_UPDATE_STRATEGY_INIT {SM_UPDATE_UNSPECIFIED, NULL}
3535

3636
extern int is_gitmodules_unmerged(const struct index_state *istate);
37-
extern int is_staging_gitmodules_ok(const struct index_state *istate);
37+
extern int is_staging_gitmodules_ok(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);
4040
extern void stage_updated_gitmodules(struct index_state *istate);

0 commit comments

Comments
 (0)