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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Nov 18, 2011 at 06:11 UTC
d05e69701053c0cf786e99251879f860702374b7
1 file changed
+6
-3
read-cache.c
+6
-3
@@ -1001,7 +1001,8 @@ int add_index_entry(struct index_state *istate, struct cache_entry *ce, int opti
1001
*/
1002
static struct cache_entry *refresh_cache_ent(struct index_state *istate,
1003
struct cache_entry *ce,
1004
- unsigned int options, int *err)
1004
+ unsigned int options, int *err,
1005
+ int *changed_ret)
1006
{
1007
struct stat st;
1008
struct cache_entry *updated;
@@ -1033,6 +1034,8 @@ static struct cache_entry *refresh_cache_ent(struct index_state *istate,
1034
}
1035
1036
changed = ie_match_stat(istate, ce, &st, options);
1037
+ if (changed_ret)
1038
+ *changed_ret = changed;
1039
if (!changed) {
1040
/*
1041
* 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
1133
if (pathspec && !match_pathspec(pathspec, ce->name, strlen(ce->name), 0, seen))
1134
continue;
1135
1133
- new = refresh_cache_ent(istate, ce, options, &cache_errno);
1136
+ new = refresh_cache_ent(istate, ce, options, &cache_errno, NULL);
1137
if (new == ce)
1138
continue;
1139
if (!new) {
@@ -1157,7 +1160,7 @@ int refresh_index(struct index_state *istate, unsigned int flags, const char **p
1160
1161
static struct cache_entry *refresh_cache_entry(struct cache_entry *ce, int really)
1162
{
1160
- return refresh_cache_ent(&the_index, ce, really, NULL);
1163
+ return refresh_cache_ent(&the_index, ce, really, NULL, NULL);
1164
}
1165
1166
static int verify_hdr(struct cache_header *hdr, unsigned long size)