diff --git a/lib/zip/file.rb b/lib/zip/file.rb index 124a2f80..80f5d8b0 100644 --- a/lib/zip/file.rb +++ b/lib/zip/file.rb @@ -103,8 +103,6 @@ def initialize(path_or_io, create: false, buffer: false, **options) raise Error, "File #{@name} not found" end - @stored_entries = @cdir.entries.map(&:dup) - @stored_comment = @cdir.comment @restore_ownership = options[:restore_ownership] @restore_permissions = options[:restore_permissions] @restore_times = options[:restore_times] @@ -318,10 +316,13 @@ def close # Returns true if any changes has been made to this archive since # the previous commit def commit_required? + return true if @create || @cdir.dirty? + @cdir.each do |e| - return true if e.dirty + return true if e.dirty? end - comment != @stored_comment || entries != @stored_entries || @create + + false end # Searches for entry with the specified name. Returns nil if