Break down no-lstat() condition checks in verify_uptodate()

Make it easier to grok under what conditions we can skip lstat(). While at there, shorten ie_match_stat() line for the sake of my eyes. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nguyễn Thái Ngọc Duy committed Jul 30, 2011 at 10:55 UTC d5b66299040969706dd675c021f4336a26a6cc82
1 file changed +13 -2
unpack-trees.c
+13 -2
@@ -1166,11 +1166,22 @@ static int verify_uptodate_1(struct cache_entry *ce,
1166 {
1167 struct stat st;
1168
1169 - if (o->index_only || (!((ce->ce_flags & CE_VALID) || ce_skip_worktree(ce)) && (o->reset || ce_uptodate(ce))))
1169 + if (o->index_only)
1170 + return 0;
1171 +
1172 + /*
1173 + * CE_VALID and CE_SKIP_WORKTREE cheat, we better check again
1174 + * if this entry is truly up-to-date because this file may be
1175 + * overwritten.
1176 + */
1177 + if ((ce->ce_flags & CE_VALID) || ce_skip_worktree(ce))
1178 + ; /* keep checking */
1179 + else if (o->reset || ce_uptodate(ce))
1180 return 0;
1181
1182 if (!lstat(ce->name, &st)) {
1173 - unsigned changed = ie_match_stat(o->src_index, ce, &st, CE_MATCH_IGNORE_VALID|CE_MATCH_IGNORE_SKIP_WORKTREE);
1183 + int flags = CE_MATCH_IGNORE_VALID|CE_MATCH_IGNORE_SKIP_WORKTREE;
1184 + unsigned changed = ie_match_stat(o->src_index, ce, &st, flags);
1185 if (!changed)
1186 return 0;
1187 /*