Skip to content

Commit d05e697

Browse files
peffgitster
authored andcommitted
read-cache: let refresh_cache_ent pass up changed flags
This will enable refresh_cache to differentiate more cases of modification (such as typechange) when telling the user what isn't fresh. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent bc1bbe0 commit d05e697

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

read-cache.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,7 +1001,8 @@ int add_index_entry(struct index_state *istate, struct cache_entry *ce, int opti
10011001
*/
10021002
static struct cache_entry *refresh_cache_ent(struct index_state *istate,
10031003
struct cache_entry *ce,
1004-
unsigned int options, int *err)
1004+
unsigned int options, int *err,
1005+
int *changed_ret)
10051006
{
10061007
struct stat st;
10071008
struct cache_entry *updated;
@@ -1033,6 +1034,8 @@ static struct cache_entry *refresh_cache_ent(struct index_state *istate,
10331034
}
10341035

10351036
changed = ie_match_stat(istate, ce, &st, options);
1037+
if (changed_ret)
1038+
*changed_ret = changed;
10361039
if (!changed) {
10371040
/*
10381041
* The path is unchanged. If we were told to ignore
@@ -1130,7 +1133,7 @@ int refresh_index(struct index_state *istate, unsigned int flags, const char **p
11301133
if (pathspec && !match_pathspec(pathspec, ce->name, strlen(ce->name), 0, seen))
11311134
continue;
11321135

1133-
new = refresh_cache_ent(istate, ce, options, &cache_errno);
1136+
new = refresh_cache_ent(istate, ce, options, &cache_errno, NULL);
11341137
if (new == ce)
11351138
continue;
11361139
if (!new) {
@@ -1157,7 +1160,7 @@ int refresh_index(struct index_state *istate, unsigned int flags, const char **p
11571160

11581161
static struct cache_entry *refresh_cache_entry(struct cache_entry *ce, int really)
11591162
{
1160-
return refresh_cache_ent(&the_index, ce, really, NULL);
1163+
return refresh_cache_ent(&the_index, ce, really, NULL, NULL);
11611164
}
11621165

11631166
static int verify_hdr(struct cache_header *hdr, unsigned long size)

0 commit comments

Comments
 (0)