@@ -547,14 +547,6 @@ def _sync_dir(self, dir_path):
547547
548548 scan_iter .close ()
549549
550- def _check_timestamps (self , stat_info , src_crtime , src_mtime ):
551- """Returns True if the timestamps of a file match those recorded in the
552- Files table. Returns False otherwise."""
553-
554- src_timestamp = src_crtime if src_crtime is not None else src_mtime
555- dst_timestamp = stat_info .crtime if stat_info .crtime is not None else stat_info .mtime
556- return src_timestamp == dst_timestamp
557-
558550 def _sync_file (self , path , stat_info ):
559551 """
560552 Syncs the file at `path` with the Files table by detecting whether the
@@ -588,16 +580,16 @@ def _sync_file(self, path, stat_info):
588580 return None
589581
590582 src = self .con .execute (
591- "SELECT id, path, crtime, mtime FROM Files WHERE ino = ?" , (stat_info .ino ,)
583+ "SELECT id, path, crtime FROM Files WHERE ino = ?" , (stat_info .ino ,)
592584 ).fetchone ()
593585
594586 # if ino is not in database, return None
595587 if src is None :
596588 return None
597- id , old_path , crtime , mtime = src
589+ id , old_path , crtime = src
598590
599591 # if timestamps don't match, delete existing record and return None
600- if not self . _check_timestamps ( stat_info , crtime , mtime ) :
592+ if crtime != stat_info . crtime :
601593 self .con .execute ("DELETE FROM Files WHERE id = ?" , (id ,))
602594 return None
603595
@@ -744,21 +736,17 @@ def get_path(self, id):
744736 # optimistic approach: first check to see if path was not yet moved
745737 for retry in [True , False ]:
746738 row = self .con .execute (
747- "SELECT path, ino, crtime, mtime FROM Files WHERE id = ?" , (id ,)
739+ "SELECT path, ino, crtime FROM Files WHERE id = ?" , (id ,)
748740 ).fetchone ()
749741
750742 # if file ID does not exist, return None
751743 if not row :
752744 return None
753745
754- path , ino , crtime , mtime = row
746+ path , ino , crtime = row
755747 stat_info = self ._stat (path )
756748
757- if (
758- stat_info
759- and ino == stat_info .ino
760- and self ._check_timestamps (stat_info , crtime , mtime )
761- ):
749+ if stat_info and ino == stat_info .ino and crtime == stat_info .crtime :
762750 # if file already exists at path and the ino and timestamps match,
763751 # then return the correct path immediately (best case)
764752 return self ._from_normalized_path (path )
0 commit comments