summaryrefslogtreecommitdiff
path: root/unpack-trees.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-07-31 18:57:32 -0700
committerJunio C Hamano <gitster@pobox.com>2011-07-31 18:57:32 -0700
commitb35acb53458d0f99ba2400b902980b35e5acc2d3 (patch)
tree2e599a9af18af3b62ce52318b2759faa7d92f311 /unpack-trees.c
parent4db0d0d1ba94c08f9476c7adff61375a752b154d (diff)
parentd5b66299040969706dd675c021f4336a26a6cc82 (diff)
downloadgit-b35acb53458d0f99ba2400b902980b35e5acc2d3.tar.gz
Merge branch 'maint'
* maint: Break down no-lstat() condition checks in verify_uptodate() t7400: fix bogus test failure with symlinked trash Documentation: clarify the invalidated tree entry format
Diffstat (limited to 'unpack-trees.c')
-rw-r--r--unpack-trees.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/unpack-trees.c b/unpack-trees.c
index 3a61d821ee..cc616c3f99 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -1168,11 +1168,22 @@ static int verify_uptodate_1(struct cache_entry *ce,
{
struct stat st;
- if (o->index_only || (!((ce->ce_flags & CE_VALID) || ce_skip_worktree(ce)) && (o->reset || ce_uptodate(ce))))
+ if (o->index_only)
+ return 0;
+
+ /*
+ * CE_VALID and CE_SKIP_WORKTREE cheat, we better check again
+ * if this entry is truly up-to-date because this file may be
+ * overwritten.
+ */
+ if ((ce->ce_flags & CE_VALID) || ce_skip_worktree(ce))
+ ; /* keep checking */
+ else if (o->reset || ce_uptodate(ce))
return 0;
if (!lstat(ce->name, &st)) {
- unsigned changed = ie_match_stat(o->src_index, ce, &st, CE_MATCH_IGNORE_VALID|CE_MATCH_IGNORE_SKIP_WORKTREE);
+ int flags = CE_MATCH_IGNORE_VALID|CE_MATCH_IGNORE_SKIP_WORKTREE;
+ unsigned changed = ie_match_stat(o->src_index, ce, &st, flags);
if (!changed)
return 0;
/*