When comparing a file against the stat cache, check size field too.
authorMichael Vrable <mvrable@cs.ucsd.edu>
Thu, 12 Jul 2007 20:05:14 +0000 (13:05 -0700)
committerMichael Vrable <mvrable@turin.ucsd.edu>
Thu, 12 Jul 2007 20:05:14 +0000 (13:05 -0700)
statcache.cc
statcache.h

index 376c099..8e48c79 100644 (file)
@@ -121,6 +121,7 @@ void StatCache::ReadNext()
     old_mtime = -1;
     old_ctime = -1;
     old_inode = -1;
+    old_size = -1;
     old_checksum = "";
     old_contents.clear();
 
@@ -171,6 +172,8 @@ void StatCache::ReadNext()
         old_ctime = parse_int(fields["ctime"]);
     if (fields.count("inode"))
         old_inode = parse_int(fields["inode"]);
+    if (fields.count("size"))
+        old_inode = parse_int(fields["size"]);
 
     old_checksum = fields["checksum"];
 
@@ -225,6 +228,8 @@ bool StatCache::Find(const string &path, const struct stat *stat_buf)
         return false;
     if ((long long)stat_buf->st_ino != old_inode)
         return false;
+    if (stat_buf->st_size != old_size)
+        return false;
 
     /* File looks to be unchanged. */
     return true;
index e0e2fbb..6186f88 100644 (file)
@@ -56,7 +56,7 @@ private:
     /* Information about one file read from the old cache. */
     bool end_of_cache;
     bool old_is_validated;
-    int64_t old_mtime, old_ctime, old_inode;
+    int64_t old_mtime, old_ctime, old_inode, old_size;
     std::string old_name, old_checksum;
     std::list<ObjectReference> old_contents;
 };