From 257627268ad19cb616ad3feb6ca8171d400df287 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 27 Jan 2014 09:45:08 -0500 Subject: read-cache.c: extend make_cache_entry refresh flag with options Convert the make_cache_entry boolean 'refresh' argument to a more general 'refresh_options' argument. Pass the value through to the underlying refresh_cache_ent call. Add option CE_MATCH_REFRESH to enable stat refresh. Update call sites to use the new signature. Signed-off-by: Brad King Signed-off-by: Junio C Hamano --- merge-recursive.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'merge-recursive.c') diff --git a/merge-recursive.c b/merge-recursive.c index fc2f00176c..05311e411c 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -201,7 +201,8 @@ static int add_cacheinfo(unsigned int mode, const unsigned char *sha1, const char *path, int stage, int refresh, int options) { struct cache_entry *ce; - ce = make_cache_entry(mode, sha1 ? sha1 : null_sha1, path, stage, refresh); + ce = make_cache_entry(mode, sha1 ? sha1 : null_sha1, path, stage, + (refresh ? CE_MATCH_REFRESH : 0 )); if (!ce) return error(_("addinfo_cache failed for path '%s'"), path); return add_cache_entry(ce, options); -- cgit v1.2.3 From 6e2068ae48000a2dfdb2044bbb91073c11f6fbff Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 27 Jan 2014 09:45:09 -0500 Subject: merge-recursive.c: tolerate missing files while refreshing index Teach add_cacheinfo to tell make_cache_entry to skip refreshing stat information when a file is missing from the work tree. We do not want the index to be stat-dirty after the merge but also do not want to fail when a file happens to be missing. This fixes the 'merge-recursive w/ empty work tree - ours has rename' case in t3030-merge-recursive. Suggested-by: Elijah Newren Signed-off-by: Brad King Signed-off-by: Junio C Hamano --- merge-recursive.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'merge-recursive.c') diff --git a/merge-recursive.c b/merge-recursive.c index 05311e411c..786dee7596 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -202,7 +202,8 @@ static int add_cacheinfo(unsigned int mode, const unsigned char *sha1, { struct cache_entry *ce; ce = make_cache_entry(mode, sha1 ? sha1 : null_sha1, path, stage, - (refresh ? CE_MATCH_REFRESH : 0 )); + (refresh ? (CE_MATCH_REFRESH | + CE_MATCH_IGNORE_MISSING) : 0 )); if (!ce) return error(_("addinfo_cache failed for path '%s'"), path); return add_cache_entry(ce, options); -- cgit v1.2.3