rubygems-update 3.2.0 → 3.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{History.txt → CHANGELOG.md} +482 -457
- data/Manifest.txt +31 -27
- data/POLICIES.md +4 -3
- data/Rakefile +23 -18
- data/bundler/CHANGELOG.md +67 -20
- data/bundler/bundler.gemspec +1 -1
- data/bundler/lib/bundler.rb +8 -2
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/bundler/lib/bundler/cli.rb +3 -6
- data/bundler/lib/bundler/cli/gem.rb +2 -0
- data/bundler/lib/bundler/cli/install.rb +14 -5
- data/bundler/lib/bundler/cli/outdated.rb +2 -2
- data/bundler/lib/bundler/cli/update.rb +1 -1
- data/bundler/lib/bundler/compact_index_client/cache.rb +5 -13
- data/bundler/lib/bundler/compact_index_client/gem_parser.rb +28 -0
- data/bundler/lib/bundler/compact_index_client/updater.rb +0 -8
- data/bundler/lib/bundler/definition.rb +24 -21
- data/bundler/lib/bundler/dependency.rb +3 -1
- data/bundler/lib/bundler/gem_helper.rb +3 -3
- data/bundler/lib/bundler/gem_helpers.rb +30 -24
- data/bundler/lib/bundler/lazy_specification.rb +16 -3
- data/bundler/{man → lib/bundler/man}/bundle-add.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-binstubs.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-cache.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-check.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-clean.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-config.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-doctor.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-exec.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-gem.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-info.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-init.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-inject.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-install.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-list.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-lock.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-open.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-outdated.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-platform.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-pristine.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-remove.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-show.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-update.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-viz.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle.1 +0 -0
- data/bundler/{man → lib/bundler/man}/gemfile.5 +0 -0
- data/bundler/{man → lib/bundler/man}/index.txt +0 -0
- data/bundler/lib/bundler/resolver.rb +29 -27
- data/bundler/lib/bundler/resolver/spec_group.rb +19 -25
- data/bundler/lib/bundler/rubygems_integration.rb +0 -6
- data/bundler/lib/bundler/source/git.rb +18 -16
- data/bundler/lib/bundler/source/git/git_proxy.rb +54 -49
- data/bundler/lib/bundler/source/path/installer.rb +2 -0
- data/bundler/lib/bundler/source/rubygems.rb +10 -1
- data/bundler/lib/bundler/spec_set.rb +5 -8
- data/bundler/lib/bundler/stub_specification.rb +0 -2
- data/bundler/lib/bundler/templates/newgem/Gemfile.tt +1 -1
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
- data/bundler/lib/bundler/templates/newgem/rubocop.yml.tt +3 -0
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +8 -1
- data/bundler/lib/bundler/version.rb +1 -1
- data/lib/rubygems.rb +1 -1
- data/lib/rubygems/commands/owner_command.rb +0 -1
- data/lib/rubygems/commands/push_command.rb +0 -1
- data/lib/rubygems/commands/setup_command.rb +16 -62
- data/lib/rubygems/commands/yank_command.rb +0 -1
- data/lib/rubygems/dependency_installer.rb +1 -0
- data/lib/rubygems/ext/builder.rb +3 -3
- data/lib/rubygems/ext/cmake_builder.rb +1 -2
- data/lib/rubygems/ext/configure_builder.rb +1 -2
- data/lib/rubygems/ext/rake_builder.rb +1 -1
- data/lib/rubygems/gemcutter_utilities.rb +22 -17
- data/lib/rubygems/installer.rb +0 -23
- data/lib/rubygems/remote_fetcher.rb +4 -2
- data/lib/rubygems/request_set.rb +2 -13
- data/lib/rubygems/resolver.rb +6 -1
- data/lib/rubygems/resolver/api_set.rb +29 -20
- data/lib/rubygems/resolver/api_set/gem_parser.rb +20 -0
- data/lib/rubygems/resolver/api_specification.rb +4 -3
- data/lib/rubygems/resolver/best_set.rb +2 -2
- data/lib/rubygems/resolver/index_specification.rb +18 -0
- data/lib/rubygems/resolver/installer_set.rb +57 -7
- data/lib/rubygems/resolver/spec_specification.rb +14 -0
- data/lib/rubygems/resolver/specification.rb +12 -0
- data/lib/rubygems/server.rb +6 -1
- data/lib/rubygems/source.rb +11 -6
- data/lib/rubygems/specification.rb +18 -14
- data/lib/rubygems/test_case.rb +17 -4
- data/lib/rubygems/test_utilities.rb +6 -5
- data/rubygems-update.gemspec +2 -2
- data/test/rubygems/data/null-required-rubygems-version.gemspec.rz +0 -0
- data/test/rubygems/test_gem_commands_install_command.rb +131 -0
- data/test/rubygems/test_gem_commands_push_command.rb +41 -2
- data/test/rubygems/test_gem_commands_setup_command.rb +21 -37
- data/test/rubygems/test_gem_dependency_installer.rb +27 -47
- data/test/rubygems/test_gem_ext_builder.rb +6 -6
- data/test/rubygems/test_gem_ext_cmake_builder.rb +2 -4
- data/test/rubygems/test_gem_ext_configure_builder.rb +2 -2
- data/test/rubygems/test_gem_ext_rake_builder.rb +25 -0
- data/test/rubygems/test_gem_installer.rb +6 -60
- data/test/rubygems/test_gem_remote_fetcher.rb +1 -1
- data/test/rubygems/test_gem_resolver_api_set.rb +54 -51
- data/test/rubygems/test_gem_resolver_api_specification.rb +3 -3
- data/test/rubygems/test_gem_resolver_best_set.rb +26 -3
- data/test/rubygems/test_gem_source.rb +2 -2
- data/test/rubygems/test_gem_source_subpath_problem.rb +2 -2
- data/test/rubygems/test_gem_specification.rb +9 -3
- data/test/test_changelog_generator.rb +17 -0
- metadata +38 -58
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -75,7 +75,7 @@ module Bundler
|
|
75
75
|
return unless debug?
|
76
76
|
debug_info = yield
|
77
77
|
debug_info = debug_info.inspect unless debug_info.is_a?(String)
|
78
|
-
|
78
|
+
puts debug_info.split("\n").map {|s| "BUNDLER: " + " " * depth + s }
|
79
79
|
end
|
80
80
|
|
81
81
|
def debug?
|
@@ -106,18 +106,19 @@ module Bundler
|
|
106
106
|
specification.dependencies_for_activated_platforms
|
107
107
|
end
|
108
108
|
|
109
|
-
def search_for(
|
110
|
-
platform =
|
111
|
-
dependency =
|
112
|
-
|
109
|
+
def search_for(dependency_proxy)
|
110
|
+
platform = dependency_proxy.__platform
|
111
|
+
dependency = dependency_proxy.dep
|
112
|
+
@search_for[dependency_proxy] ||= begin
|
113
|
+
name = dependency.name
|
113
114
|
index = index_for(dependency)
|
114
|
-
results = index.search(dependency, @base[
|
115
|
+
results = index.search(dependency, @base[name])
|
115
116
|
|
116
|
-
if vertex = @base_dg.vertex_named(
|
117
|
+
if vertex = @base_dg.vertex_named(name)
|
117
118
|
locked_requirement = vertex.payload.requirement
|
118
119
|
end
|
119
120
|
|
120
|
-
if !@prerelease_specified[
|
121
|
+
if !@prerelease_specified[name] && (!@use_gvp || locked_requirement.nil?)
|
121
122
|
# Move prereleases to the beginning of the list, so they're considered
|
122
123
|
# last during resolution.
|
123
124
|
pre, results = results.partition {|spec| spec.version.prerelease? }
|
@@ -145,31 +146,32 @@ module Bundler
|
|
145
146
|
end
|
146
147
|
# GVP handles major itself, but it's still a bit risky to trust it with it
|
147
148
|
# until we get it settled with new behavior. For 2.x it can take over all cases.
|
148
|
-
if !@use_gvp
|
149
|
+
search = if !@use_gvp
|
149
150
|
spec_groups
|
150
151
|
else
|
151
152
|
@gem_version_promoter.sort_versions(dependency, spec_groups)
|
152
153
|
end
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
154
|
+
selected_sgs = []
|
155
|
+
search.each do |sg|
|
156
|
+
next unless sg.for?(platform)
|
157
|
+
sg_all_platforms = sg.copy_for(self.class.sort_platforms(@platforms).reverse)
|
158
|
+
next unless sg_all_platforms
|
159
|
+
|
160
|
+
selected_sgs << sg_all_platforms
|
161
|
+
|
162
|
+
next if sg_all_platforms.activated_platforms == [Gem::Platform::RUBY]
|
163
|
+
# Add a spec group for "non platform specific spec" as the fallback
|
164
|
+
# spec group.
|
165
|
+
sg_ruby = sg.copy_for([Gem::Platform::RUBY])
|
166
|
+
next unless sg_ruby
|
167
|
+
|
168
|
+
sg_ruby_deps = sg_ruby.dependencies_for_activated_platforms.map(&:dep)
|
169
|
+
sg_all_platforms_deps = sg_all_platforms.dependencies_for_activated_platforms.map(&:dep)
|
170
|
+
|
171
|
+
selected_sgs.insert(-2, sg_ruby) if sg_ruby_deps != sg_all_platforms_deps
|
169
172
|
end
|
170
|
-
selected_sgs
|
173
|
+
selected_sgs
|
171
174
|
end
|
172
|
-
selected_sgs
|
173
175
|
end
|
174
176
|
|
175
177
|
def index_for(dependency)
|
@@ -6,7 +6,7 @@ module Bundler
|
|
6
6
|
include GemHelpers
|
7
7
|
|
8
8
|
attr_accessor :name, :version, :source
|
9
|
-
attr_accessor :ignores_bundler_dependencies
|
9
|
+
attr_accessor :ignores_bundler_dependencies, :activated_platforms
|
10
10
|
|
11
11
|
def initialize(all_specs)
|
12
12
|
@all_specs = all_specs
|
@@ -25,33 +25,29 @@ module Bundler
|
|
25
25
|
|
26
26
|
def to_specs
|
27
27
|
@activated_platforms.map do |p|
|
28
|
-
|
29
|
-
|
30
|
-
lazy_spec.dependencies.replace s.dependencies
|
31
|
-
lazy_spec
|
32
|
-
end.compact.uniq
|
33
|
-
end
|
28
|
+
specs = @specs[p]
|
29
|
+
next unless specs.any?
|
34
30
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
31
|
+
specs.map do |s|
|
32
|
+
lazy_spec = LazySpecification.new(name, version, s.platform, source)
|
33
|
+
lazy_spec.dependencies.replace s.dependencies
|
34
|
+
lazy_spec
|
35
|
+
end
|
36
|
+
end.flatten.compact.uniq
|
39
37
|
end
|
40
38
|
|
41
|
-
def copy_for(
|
39
|
+
def copy_for(platforms)
|
40
|
+
platforms.select! {|p| for?(p) }
|
41
|
+
return unless platforms.any?
|
42
|
+
|
42
43
|
copied_sg = self.class.new(@all_specs)
|
43
44
|
copied_sg.ignores_bundler_dependencies = @ignores_bundler_dependencies
|
44
|
-
|
45
|
-
copied_sg.activate_platform!(platform)
|
45
|
+
copied_sg.activated_platforms = platforms
|
46
46
|
copied_sg
|
47
47
|
end
|
48
48
|
|
49
|
-
def spec_for(platform)
|
50
|
-
@specs[platform]
|
51
|
-
end
|
52
|
-
|
53
49
|
def for?(platform)
|
54
|
-
|
50
|
+
@specs[platform].any?
|
55
51
|
end
|
56
52
|
|
57
53
|
def to_s
|
@@ -62,7 +58,7 @@ module Bundler
|
|
62
58
|
def dependencies_for_activated_platforms
|
63
59
|
dependencies = @activated_platforms.map {|p| __dependencies[p] }
|
64
60
|
metadata_dependencies = @activated_platforms.map do |platform|
|
65
|
-
metadata_dependencies(@specs[platform], platform)
|
61
|
+
metadata_dependencies(@specs[platform].first, platform)
|
66
62
|
end
|
67
63
|
dependencies.concat(metadata_dependencies).flatten
|
68
64
|
end
|
@@ -98,7 +94,8 @@ module Bundler
|
|
98
94
|
def __dependencies
|
99
95
|
@dependencies = Hash.new do |dependencies, platform|
|
100
96
|
dependencies[platform] = []
|
101
|
-
|
97
|
+
specs = @specs[platform]
|
98
|
+
if spec = specs.first
|
102
99
|
spec.dependencies.each do |dep|
|
103
100
|
next if dep.type == :development
|
104
101
|
next if @ignores_bundler_dependencies && dep.name == "bundler".freeze
|
@@ -110,10 +107,7 @@ module Bundler
|
|
110
107
|
end
|
111
108
|
|
112
109
|
def metadata_dependencies(spec, platform)
|
113
|
-
return [] unless spec
|
114
|
-
# Only allow endpoint specifications since they won't hit the network to
|
115
|
-
# fetch the full gemspec when calling required_ruby_version
|
116
|
-
return [] if !spec.is_a?(EndpointSpecification) && !spec.is_a?(Gem::Specification)
|
110
|
+
return [] unless spec && spec.is_a?(Gem::Specification)
|
117
111
|
dependencies = []
|
118
112
|
if !spec.required_ruby_version.nil? && !spec.required_ruby_version.none?
|
119
113
|
dependencies << DepProxy.new(Gem::Dependency.new("Ruby\0", spec.required_ruby_version), platform)
|
@@ -110,11 +110,6 @@ module Bundler
|
|
110
110
|
obj.to_s
|
111
111
|
end
|
112
112
|
|
113
|
-
def platforms
|
114
|
-
return [Gem::Platform::RUBY] if Bundler.settings[:force_ruby_platform]
|
115
|
-
Gem.platforms
|
116
|
-
end
|
117
|
-
|
118
113
|
def configuration
|
119
114
|
require_relative "psyched_yaml"
|
120
115
|
Gem.configuration
|
@@ -565,7 +560,6 @@ module Bundler
|
|
565
560
|
end
|
566
561
|
|
567
562
|
def all_specs
|
568
|
-
require_relative "remote_specification"
|
569
563
|
Gem::Specification.stubs.map do |stub|
|
570
564
|
StubSpecification.from_stub(stub)
|
571
565
|
end
|
@@ -22,7 +22,7 @@ module Bundler
|
|
22
22
|
@uri = options["uri"] || ""
|
23
23
|
@safe_uri = URICredentialsFilter.credential_filtered_uri(@uri)
|
24
24
|
@branch = options["branch"]
|
25
|
-
@ref = options["ref"] || options["branch"] || options["tag"]
|
25
|
+
@ref = options["ref"] || options["branch"] || options["tag"]
|
26
26
|
@submodules = options["submodules"]
|
27
27
|
@name = options["name"]
|
28
28
|
@version = options["version"].to_s.strip.gsub("-", ".pre.")
|
@@ -60,25 +60,27 @@ module Bundler
|
|
60
60
|
alias_method :==, :eql?
|
61
61
|
|
62
62
|
def to_s
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
63
|
+
begin
|
64
|
+
at = if local?
|
65
|
+
path
|
66
|
+
elsif user_ref = options["ref"]
|
67
|
+
if ref =~ /\A[a-z0-9]{4,}\z/i
|
68
|
+
shortref_for_display(user_ref)
|
69
|
+
else
|
70
|
+
user_ref
|
71
|
+
end
|
72
|
+
elsif ref
|
73
|
+
ref
|
68
74
|
else
|
69
|
-
|
75
|
+
git_proxy.branch
|
70
76
|
end
|
71
|
-
else
|
72
|
-
ref
|
73
|
-
end
|
74
77
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
end
|
78
|
+
rev = " (at #{at}@#{shortref_for_display(revision)})"
|
79
|
+
rescue GitError
|
80
|
+
""
|
81
|
+
end
|
80
82
|
|
81
|
-
"#{@safe_uri}
|
83
|
+
"#{@safe_uri}#{rev}"
|
82
84
|
end
|
83
85
|
|
84
86
|
def name
|
@@ -17,7 +17,7 @@ module Bundler
|
|
17
17
|
class GitNotAllowedError < GitError
|
18
18
|
def initialize(command)
|
19
19
|
msg = String.new
|
20
|
-
msg << "Bundler is trying to run
|
20
|
+
msg << "Bundler is trying to run `#{command}` at runtime. You probably need to run `bundle install`. However, "
|
21
21
|
msg << "this error message could probably be more useful. Please submit a ticket at https://github.com/rubygems/rubygems/issues/new?labels=Bundler&template=bundler-related-issue.md "
|
22
22
|
msg << "with steps to reproduce as well as the following\n\nCALLER: #{caller.join("\n")}"
|
23
23
|
super msg
|
@@ -27,11 +27,11 @@ module Bundler
|
|
27
27
|
class GitCommandError < GitError
|
28
28
|
attr_reader :command
|
29
29
|
|
30
|
-
def initialize(command, path,
|
30
|
+
def initialize(command, path, extra_info = nil)
|
31
31
|
@command = command
|
32
32
|
|
33
33
|
msg = String.new
|
34
|
-
msg << "Git error: command
|
34
|
+
msg << "Git error: command `#{command}` in directory #{path} has failed."
|
35
35
|
msg << "\n#{extra_info}" if extra_info
|
36
36
|
msg << "\nIf this error persists you could try removing the cache directory '#{path}'" if path.exist?
|
37
37
|
super msg
|
@@ -39,9 +39,9 @@ module Bundler
|
|
39
39
|
end
|
40
40
|
|
41
41
|
class MissingGitRevisionError < GitCommandError
|
42
|
-
def initialize(command,
|
42
|
+
def initialize(command, destination_path, ref, repo)
|
43
43
|
msg = "Revision #{ref} does not exist in the repository #{repo}. Maybe you misspelled it?"
|
44
|
-
super command,
|
44
|
+
super command, destination_path, msg
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
@@ -67,13 +67,13 @@ module Bundler
|
|
67
67
|
|
68
68
|
def branch
|
69
69
|
@branch ||= allowed_with_path do
|
70
|
-
git("rev-parse --abbrev-ref HEAD", :dir => path).strip
|
70
|
+
git("rev-parse", "--abbrev-ref", "HEAD", :dir => path).strip
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
74
|
def contains?(commit)
|
75
75
|
allowed_with_path do
|
76
|
-
result, status = git_null("branch --contains
|
76
|
+
result, status = git_null("branch", "--contains", commit, :dir => path)
|
77
77
|
status.success? && result =~ /^\* (.*)$/
|
78
78
|
end
|
79
79
|
end
|
@@ -88,20 +88,22 @@ module Bundler
|
|
88
88
|
|
89
89
|
def checkout
|
90
90
|
return if path.exist? && has_revision_cached?
|
91
|
-
extra_ref = "#{
|
91
|
+
extra_ref = "#{ref}:#{ref}" if ref && ref.start_with?("refs/")
|
92
92
|
|
93
93
|
Bundler.ui.info "Fetching #{URICredentialsFilter.credential_filtered_uri(uri)}"
|
94
94
|
|
95
|
+
configured_uri = configured_uri_for(uri).to_s
|
96
|
+
|
95
97
|
unless path.exist?
|
96
98
|
SharedHelpers.filesystem_access(path.dirname) do |p|
|
97
99
|
FileUtils.mkdir_p(p)
|
98
100
|
end
|
99
|
-
git_retry
|
101
|
+
git_retry "clone", configured_uri, path.to_s, "--bare", "--no-hardlinks", "--quiet"
|
100
102
|
return unless extra_ref
|
101
103
|
end
|
102
104
|
|
103
105
|
with_path do
|
104
|
-
git_retry
|
106
|
+
git_retry(*["fetch", "--force", "--quiet", "--tags", configured_uri, "refs/heads/*:refs/heads/*", extra_ref].compact, :dir => path)
|
105
107
|
end
|
106
108
|
end
|
107
109
|
|
@@ -115,7 +117,7 @@ module Bundler
|
|
115
117
|
SharedHelpers.filesystem_access(destination) do |p|
|
116
118
|
FileUtils.rm_rf(p)
|
117
119
|
end
|
118
|
-
git_retry
|
120
|
+
git_retry "clone", "--no-checkout", "--quiet", path.to_s, destination.to_s
|
119
121
|
File.chmod(((File.stat(destination).mode | 0o777) & ~File.umask), destination)
|
120
122
|
rescue Errno::EEXIST => e
|
121
123
|
file_path = e.message[%r{.*?((?:[a-zA-Z]:)?/.*)}, 1]
|
@@ -125,56 +127,59 @@ module Bundler
|
|
125
127
|
end
|
126
128
|
end
|
127
129
|
# method 2
|
128
|
-
git_retry
|
130
|
+
git_retry "fetch", "--force", "--quiet", "--tags", path.to_s, :dir => destination
|
129
131
|
|
130
132
|
begin
|
131
|
-
git "reset --hard
|
133
|
+
git "reset", "--hard", @revision, :dir => destination
|
132
134
|
rescue GitCommandError => e
|
133
|
-
raise MissingGitRevisionError.new(e.command,
|
135
|
+
raise MissingGitRevisionError.new(e.command, destination, @revision, URICredentialsFilter.credential_filtered_uri(uri))
|
134
136
|
end
|
135
137
|
|
136
138
|
if submodules
|
137
|
-
git_retry "submodule update --init --recursive", :dir => destination
|
139
|
+
git_retry "submodule", "update", "--init", "--recursive", :dir => destination
|
138
140
|
elsif Gem::Version.create(version) >= Gem::Version.create("2.9.0")
|
139
141
|
inner_command = "git -C $toplevel submodule deinit --force $sm_path"
|
140
|
-
|
141
|
-
git_retry "submodule foreach --quiet \"#{inner_command}\"", :dir => destination
|
142
|
+
git_retry "submodule", "foreach", "--quiet", inner_command, :dir => destination
|
142
143
|
end
|
143
144
|
end
|
144
145
|
|
145
146
|
private
|
146
147
|
|
147
|
-
def git_null(command, dir:
|
148
|
+
def git_null(*command, dir: nil)
|
148
149
|
check_allowed(command)
|
149
150
|
|
150
151
|
out, status = SharedHelpers.with_clean_git_env do
|
151
|
-
capture_and_ignore_stderr(
|
152
|
+
capture_and_ignore_stderr(*capture3_args_for(command, dir))
|
152
153
|
end
|
153
154
|
|
154
155
|
[URICredentialsFilter.credential_filtered_string(out, uri), status]
|
155
156
|
end
|
156
157
|
|
157
|
-
def git_retry(command, dir:
|
158
|
-
|
159
|
-
|
158
|
+
def git_retry(*command, dir: nil)
|
159
|
+
command_with_no_credentials = check_allowed(command)
|
160
|
+
|
161
|
+
Bundler::Retry.new("`#{command_with_no_credentials}` at #{dir || SharedHelpers.pwd}").attempts do
|
162
|
+
git(*command, :dir => dir)
|
160
163
|
end
|
161
164
|
end
|
162
165
|
|
163
|
-
def git(command, dir:
|
166
|
+
def git(*command, dir: nil)
|
164
167
|
command_with_no_credentials = check_allowed(command)
|
165
168
|
|
166
169
|
out, status = SharedHelpers.with_clean_git_env do
|
167
|
-
capture_and_filter_stderr(
|
170
|
+
capture_and_filter_stderr(*capture3_args_for(command, dir))
|
168
171
|
end
|
169
172
|
|
170
|
-
|
173
|
+
filtered_out = URICredentialsFilter.credential_filtered_string(out, uri)
|
174
|
+
|
175
|
+
raise GitCommandError.new(command_with_no_credentials, dir || SharedHelpers.pwd, filtered_out) unless status.success?
|
171
176
|
|
172
|
-
|
177
|
+
filtered_out
|
173
178
|
end
|
174
179
|
|
175
180
|
def has_revision_cached?
|
176
181
|
return unless @revision
|
177
|
-
with_path { git("cat-file -e
|
182
|
+
with_path { git("cat-file", "-e", @revision, :dir => path) }
|
178
183
|
true
|
179
184
|
rescue GitError
|
180
185
|
false
|
@@ -186,24 +191,10 @@ module Bundler
|
|
186
191
|
|
187
192
|
def find_local_revision
|
188
193
|
allowed_with_path do
|
189
|
-
git("rev-parse --verify
|
194
|
+
git("rev-parse", "--verify", ref || "HEAD", :dir => path).strip
|
190
195
|
end
|
191
196
|
rescue GitCommandError => e
|
192
|
-
raise MissingGitRevisionError.new(e.command, path,
|
193
|
-
end
|
194
|
-
|
195
|
-
# Escape the URI for git commands
|
196
|
-
def uri_escaped_with_configured_credentials
|
197
|
-
remote = configured_uri_for(uri)
|
198
|
-
if Bundler::WINDOWS
|
199
|
-
# Windows quoting requires double quotes only, with double quotes
|
200
|
-
# inside the string escaped by being doubled.
|
201
|
-
'"' + remote.gsub('"') { '""' } + '"'
|
202
|
-
else
|
203
|
-
# Bash requires single quoted strings, with the single quotes escaped
|
204
|
-
# by ending the string, escaping the quote, and restarting the string.
|
205
|
-
"'" + remote.gsub("'") { "'\\''" } + "'"
|
206
|
-
end
|
197
|
+
raise MissingGitRevisionError.new(e.command, path, ref, URICredentialsFilter.credential_filtered_uri(uri))
|
207
198
|
end
|
208
199
|
|
209
200
|
# Adds credentials to the URI as Fetcher#configured_uri_for does
|
@@ -233,23 +224,37 @@ module Bundler
|
|
233
224
|
end
|
234
225
|
|
235
226
|
def check_allowed(command)
|
236
|
-
command_with_no_credentials = URICredentialsFilter.credential_filtered_string(command, uri)
|
227
|
+
command_with_no_credentials = URICredentialsFilter.credential_filtered_string("git #{command.shelljoin}", uri)
|
237
228
|
raise GitNotAllowedError.new(command_with_no_credentials) unless allow?
|
238
229
|
command_with_no_credentials
|
239
230
|
end
|
240
231
|
|
241
|
-
def capture_and_filter_stderr(
|
232
|
+
def capture_and_filter_stderr(*cmd)
|
242
233
|
require "open3"
|
243
|
-
return_value, captured_err, status = Open3.capture3(cmd
|
244
|
-
Bundler.ui.warn URICredentialsFilter.credential_filtered_string(captured_err, uri)
|
234
|
+
return_value, captured_err, status = Open3.capture3(*cmd)
|
235
|
+
Bundler.ui.warn URICredentialsFilter.credential_filtered_string(captured_err, uri) unless captured_err.empty?
|
245
236
|
[return_value, status]
|
246
237
|
end
|
247
238
|
|
248
|
-
def capture_and_ignore_stderr(cmd
|
239
|
+
def capture_and_ignore_stderr(*cmd)
|
249
240
|
require "open3"
|
250
|
-
return_value, _, status = Open3.capture3(cmd
|
241
|
+
return_value, _, status = Open3.capture3(*cmd)
|
251
242
|
[return_value, status]
|
252
243
|
end
|
244
|
+
|
245
|
+
def capture3_args_for(cmd, dir)
|
246
|
+
return ["git", *cmd] unless dir
|
247
|
+
|
248
|
+
if Bundler.feature_flag.bundler_3_mode? || supports_minus_c?
|
249
|
+
["git", "-C", dir.to_s, *cmd]
|
250
|
+
else
|
251
|
+
["git", *cmd, { :chdir => dir.to_s }]
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
def supports_minus_c?
|
256
|
+
@supports_minus_c ||= Gem::Version.new(version) >= Gem::Version.new("1.8.5")
|
257
|
+
end
|
253
258
|
end
|
254
259
|
end
|
255
260
|
end
|