Use [mtime, ctime].max for == comparaison

Conflicts:

	lib/guard/listener.rb
This commit is contained in:
Thibaud Guillaume-Gentil 2011-09-05 08:22:08 +02:00 committed by Michael Kessler
parent 59103ffe09
commit 16fe7441d4

View File

@ -144,9 +144,11 @@ module Guard
# both values down to the second for the comparison. # both values down to the second for the comparison.
# ctime is used only on == comparaison to always catches Rails 3.1 Assets pipelined on Mac OSX # ctime is used only on == comparaison to always catches Rails 3.1 Assets pipelined on Mac OSX
def file_modified?(path, last_event) def file_modified?(path, last_event)
if File.ctime(path).to_i == last_event.to_i ctime = File.ctime(path).to_i
mtime = File.mtime(path).to_i
if [mtime, ctime].max == last_event.to_i
file_content_modified?(path, sha1_checksum(path)) file_content_modified?(path, sha1_checksum(path))
elsif File.mtime(path).to_i > last_event.to_i elsif mtime > last_event.to_i
set_sha1_checksums_hash(path, sha1_checksum(path)) set_sha1_checksums_hash(path, sha1_checksum(path))
true true
else else