diff --git a/lib/rdoc/rdoc.rb b/lib/rdoc/rdoc.rb index 2da6d9b575..516731c874 100644 --- a/lib/rdoc/rdoc.rb +++ b/lib/rdoc/rdoc.rb @@ -125,12 +125,14 @@ def gather_files files file_list = remove_unparseable(file_list) + result = [] if file_list.count {|name, mtime| + result << name if mtime || @options.force_update file_list[name] = @last_modified[name] unless mtime mtime } > 0 @last_modified.replace file_list - file_list.keys.sort + result.sort else [] end diff --git a/test/rdoc/test_rdoc_rdoc.rb b/test/rdoc/test_rdoc_rdoc.rb index 5168932430..ae4f8904c1 100644 --- a/test/rdoc/test_rdoc_rdoc.rb +++ b/test/rdoc/test_rdoc_rdoc.rb @@ -80,6 +80,17 @@ def test_gather_files assert_equal [a, b], @rdoc.gather_files([b, a, b]) end + def test_gather_files_with_no_force_update + a = File.expand_path __FILE__ + b = File.expand_path '../test_rdoc_text.rb', __FILE__ + + assert_equal [a, b], @rdoc.gather_files([a, b]) + + @rdoc.last_modified[a] -= 10 + @rdoc.options.force_update = false + assert_equal [a], @rdoc.gather_files([a, b]) + end + def test_handle_pipe $stdin = StringIO.new "hello"