Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Pass -z arg to git ls-files & split on null char #2634

Merged
merged 1 commit into from
Sep 13, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bundler.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'ronn', '~> 0.7.3'
spec.add_development_dependency 'rspec', '~> 2.11'

spec.files = `git ls-files`.split($/)
spec.files = `git ls-files -z`.split("\x0")
spec.files += Dir.glob('lib/bundler/man/**/*') # man/ is ignored by git
spec.test_files = spec.files.grep(%r{^spec/})

Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/templates/newgem/newgem.gemspec.tt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
spec.homepage = ""
spec.license = "MIT"

spec.files = `git ls-files`.split($/)
spec.files = `git ls-files -z`.split("\x0")
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
Expand Down
2 changes: 1 addition & 1 deletion spec/install/git_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
git = update_git "foo" do |s|
s.executables = ["foobar"] # we added this the first time, so keep it now
s.files = ["bin/foobar"] # updating git nukes the files list
foospec = s.to_ruby.gsub(/s\.files.*/, 's.files = `git ls-files`.split("\n")')
foospec = s.to_ruby.gsub(/s\.files.*/, 's.files = `git ls-files -z`.split("\x0")')
s.write "foo.gemspec", foospec
end

Expand Down
4 changes: 2 additions & 2 deletions spec/quality_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def check_for_extra_spaces(filename)
exempt = /\.gitmodules|\.marshal|fixtures|vendor|ssl_certs|LICENSE/
error_messages = []
Dir.chdir(File.expand_path("../..", __FILE__)) do
`git ls-files`.split("\n").each do |filename|
`git ls-files -z`.split("\x0").each do |filename|
next if filename =~ exempt
error_messages << check_for_tab_characters(filename)
error_messages << check_for_extra_spaces(filename)
Expand All @@ -67,7 +67,7 @@ def check_for_extra_spaces(filename)
included = /spec/
error_messages = []
Dir.chdir(File.expand_path("../", __FILE__)) do
`git ls-files`.split("\n").each do |filename|
`git ls-files -z`.split("\x0").each do |filename|
next unless filename =~ included
error_messages << check_for_spec_defs_with_single_quotes(filename)
end
Expand Down