From 5978e875dfa0506da074697463c69d6c5a865f70 Mon Sep 17 00:00:00 2001 From: Thibaud Guillaume-Gentil Date: Sat, 3 Sep 2011 14:43:25 +0200 Subject: [PATCH] Put mtime (maybe ctime is updated on linux when moving a file) --- lib/guard/listener.rb | 3 ++- spec/guard/listeners/polling_spec.rb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/guard/listener.rb b/lib/guard/listener.rb index 7f50139..0b38a35 100644 --- a/lib/guard/listener.rb +++ b/lib/guard/listener.rb @@ -84,7 +84,7 @@ module Guard end def modified_files(dirs, options = {}) - last_event = @last_event.dup + last_event = @last_event update_last_event files = potentially_modified_files(dirs, options).select { |path| file_modified?(path, last_event) } p "modified_files" @@ -150,6 +150,7 @@ module Guard p @last_event.to_i p last_event.to_i p File.ctime(path).to_i + p File.mtime(path).to_i if File.ctime(path).to_i == last_event.to_i p "File.ctime == last_event" res = file_content_modified?(path, sha1_checksum(path)) diff --git a/spec/guard/listeners/polling_spec.rb b/spec/guard/listeners/polling_spec.rb index d6fcc29..072421e 100644 --- a/spec/guard/listeners/polling_spec.rb +++ b/spec/guard/listeners/polling_spec.rb @@ -4,6 +4,6 @@ require 'guard/listeners/polling' describe Guard::Polling do subject { Guard::Polling } - it_should_behave_like "a listener that reacts to #on_change", 2 + it_should_behave_like "a listener that reacts to #on_change" it_should_behave_like "a listener scoped to a specific directory" end