Skip to content

Commit 768d796

Browse files
jamillgitster
authored andcommitted
read-cache: teach refresh_cache_entry to take istate
Refactor refresh_cache_entry() to work on a specific index, instead of implicitly using the_index. This is in preparation for making the make_cache_entry function apply to a specific index. Signed-off-by: Jameson Miller <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 53f9a3e commit 768d796

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

cache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ extern void fill_stat_cache_info(struct cache_entry *ce, struct stat *st);
751751
#define REFRESH_IGNORE_SUBMODULES 0x0010 /* ignore submodules */
752752
#define REFRESH_IN_PORCELAIN 0x0020 /* user friendly output, not "needs update" */
753753
extern int refresh_index(struct index_state *, unsigned int flags, const struct pathspec *pathspec, char *seen, const char *header_msg);
754-
extern struct cache_entry *refresh_cache_entry(struct cache_entry *, unsigned int);
754+
extern struct cache_entry *refresh_cache_entry(struct index_state *, struct cache_entry *, unsigned int);
755755

756756
/*
757757
* Opportunistically update the index but do not complain if we can't.

merge-recursive.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ static int add_cacheinfo(struct merge_options *o,
323323
if (refresh) {
324324
struct cache_entry *nce;
325325

326-
nce = refresh_cache_entry(ce, CE_MATCH_REFRESH | CE_MATCH_IGNORE_MISSING);
326+
nce = refresh_cache_entry(&the_index, ce, CE_MATCH_REFRESH | CE_MATCH_IGNORE_MISSING);
327327
if (!nce)
328328
return err(o, _("add_cacheinfo failed to refresh for path '%s'; merge aborting."), path);
329329
if (nce != ce)

read-cache.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ struct cache_entry *make_cache_entry(unsigned int mode,
767767
ce->ce_namelen = len;
768768
ce->ce_mode = create_ce_mode(mode);
769769

770-
ret = refresh_cache_entry(ce, refresh_options);
770+
ret = refresh_cache_entry(&the_index, ce, refresh_options);
771771
if (ret != ce)
772772
free(ce);
773773
return ret;
@@ -1473,10 +1473,11 @@ int refresh_index(struct index_state *istate, unsigned int flags,
14731473
return has_errors;
14741474
}
14751475

1476-
struct cache_entry *refresh_cache_entry(struct cache_entry *ce,
1477-
unsigned int options)
1476+
struct cache_entry *refresh_cache_entry(struct index_state *istate,
1477+
struct cache_entry *ce,
1478+
unsigned int options)
14781479
{
1479-
return refresh_cache_ent(&the_index, ce, options, NULL, NULL);
1480+
return refresh_cache_ent(istate, ce, options, NULL, NULL);
14801481
}
14811482

14821483

0 commit comments

Comments
 (0)