Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix #365 producing huge packages because of hard links

  • Loading branch information...
commit cdb5e132e5bd69782684132ae72baa64b96ba5da 1 parent ff16e2c
Vladimir Yarotsky authored
Showing with 13 additions and 1 deletion.
  1. +13 −1 lib/fpm/util.rb
View
14 lib/fpm/util.rb
@@ -155,7 +155,19 @@ def copy_entry(src, dst)
when 'directory'
FileUtils.mkdir(dst) unless File.exists? dst
else
- FileUtils.copy_entry(src, dst)
+ # if the file with the same inode has been copied already -
+ # hard link it's copy to `dst`, otherwise make an actual copy
+ st = File.stat(src)
+ if copied_entry = copied_entries[st.ino]
+ FileUtils.ln(copied_entry, dst)
+ else
+ FileUtils.copy_entry(src, dst)
+ copied_entries.store(st.ino, dst)
+ end
end
end
+
+ def copied_entries
+ @copied_entries ||= {}
+ end
end # module FPM::Util
Please sign in to comment.
Something went wrong with that request. Please try again.