Skip to content

Commit

Permalink
use file size to check for modifications
Browse files Browse the repository at this point in the history
responds to issue #335
  • Loading branch information
marawan31 authored and ioquatix committed Aug 23, 2020
1 parent 2d0a391 commit debf5cb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/listen/file.rb
Expand Up @@ -6,7 +6,7 @@ def self.change(record, rel_path)
path = Pathname.new(record.root) + rel_path
lstat = path.lstat

data = { mtime: lstat.mtime.to_f, mode: lstat.mode }
data = { mtime: lstat.mtime.to_f, mode: lstat.mode, size: lstat.size }

record_data = record.file_data(rel_path)

Expand All @@ -24,7 +24,12 @@ def self.change(record, rel_path)
record.update_file(rel_path, data)
return :modified
end


if data[:size] != record_data[:size]
record.update_file(rel_path, data)
return :modified
end

return if /1|true/ =~ ENV['LISTEN_GEM_DISABLE_HASHING']
return unless inaccurate_mac_time?(lstat)

Expand Down

0 comments on commit debf5cb

Please sign in to comment.