Re: [PATCH 2/2] read-cache.c: fix timestamp comparison
- From
Linus Torvalds <torvalds@linux-foundation.org>
- Date
- Jan 21, 2008, 19:24 UTC
- Message-ID
- <alpine.LFD.1.00.0801211120350.2957@woody.linux-foundation.org>
- In-Reply-To
- <alpine.LFD.1.00.0801211104590.2957@woody.linux-foundation.org>
On Mon, 21 Jan 2008, Linus Torvalds wrote:
> > Still looking.
Damn.
The comment that I also moved says it all.
I'd forgotten about that really ugly special case. It's no longer ugly, but missing that part of the ce_mode handling cleanup certainly explains the test-suite failing.
Linus
--- read-cache.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/read-cache.c b/read-cache.c index f5f9c3d..58a9b95 100644 --- a/read-cache.c +++ b/read-cache.c @@ -124,6 +124,9 @@ static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st) { unsigned int changed = 0; + if (ce->ce_flags & CE_REMOVE) + return MODE_CHANGED | DATA_CHANGED | TYPE_CHANGED; + switch (ce->ce_mode & S_IFMT) { case S_IFREG: changed |= !S_ISREG(st->st_mode) ? TYPE_CHANGED : 0; @@ -145,8 +149,6 @@ static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st) else if (ce_compare_gitlink(ce)) changed |= DATA_CHANGED; return changed; - case 0: /* Special case: unmerged file in index */ - return MODE_CHANGED | DATA_CHANGED | TYPE_CHANGED; default: die("internal error: ce_mode is %o", ce->ce_mode); }