Skip to content

Commit

Permalink
Fix a Minitar.pack bug to include hidden files.
Browse files Browse the repository at this point in the history
  • Loading branch information
halostatue committed Feb 7, 2017
1 parent 121ffeb commit 9781357
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@
with no path components.
* Fix [#14][] provided by @kzys should fix Windows detection issues.
* Fix [#16][] as specified above.
* Fix an issue where Minitar.pack would not include Unix hidden files
when creating a tarball.

* Development:

Expand Down
7 changes: 4 additions & 3 deletions lib/archive/tar/minitar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -215,18 +215,19 @@ def pack_file(entry, outputter) #:yields action, name, stats:
# If +src+ is an Array, it will be treated as the result of Find.find; all
# files matching will be packed.
def pack(src, dest, recurse_dirs = true, &block)
require 'find'
Output.open(dest) do |outp|
if src.kind_of?(Array)
src.each do |entry|
pack_file(entry, outp, &block)
if dir?(entry) and recurse_dirs
Dir["#{entry}/**/**"].each do |ee|
Find.find(entry) do |ee|
pack_file(ee, outp, &block)
end
else
pack_file(entry, outp, &block)
end
end
else
require 'find'
Find.find(src) do |entry|
pack_file(entry, outp, &block)
end
Expand Down

0 comments on commit 9781357

Please sign in to comment.