Skip to content

Commit 34f6334

Browse files
deivid-rodriguezmatzbot
authored andcommitted
[rubygems/rubygems] Improve naming in git sources
The "revision" attribute is actually getting the revision from the Gemfile.lock file. So I think "locked" is a better term here to avoid confusion with the revision checked out in `vendor/cache`. rubygems/rubygems@ca5bdebe1f
1 parent 8aeb67d commit 34f6334

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

lib/bundler/source/git.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def to_s
102102
end
103103

104104
def identifier
105-
uri_with_specifiers([humanized_ref, cached_revision, glob_for_display])
105+
uri_with_specifiers([humanized_ref, locked_revision, glob_for_display])
106106
end
107107

108108
def uri_with_specifiers(specifiers)
@@ -176,10 +176,10 @@ def local_override!(path)
176176
"#{current_branch} but Gemfile specifies #{branch}"
177177
end
178178

179-
changed = cached_revision && cached_revision != revision
179+
changed = locked_revision && locked_revision != revision
180180

181-
if !Bundler.settings[:disable_local_revision_check] && changed && !@unlocked && !git_proxy.contains?(cached_revision)
182-
raise GitError, "The Gemfile lock is pointing to revision #{shortref_for_display(cached_revision)} " \
181+
if !Bundler.settings[:disable_local_revision_check] && changed && !@unlocked && !git_proxy.contains?(locked_revision)
182+
raise GitError, "The Gemfile lock is pointing to revision #{shortref_for_display(locked_revision)} " \
183183
"but the current branch in your local override for #{name} does not contain such commit. " \
184184
"Please make sure your branch is up to date."
185185
end
@@ -249,7 +249,7 @@ def cache_path
249249
end
250250

251251
def app_cache_dirname
252-
"#{base_name}-#{shortref_for_path(cached_revision || revision)}"
252+
"#{base_name}-#{shortref_for_path(locked_revision || revision)}"
253253
end
254254

255255
def revision
@@ -326,19 +326,19 @@ def set_up_app_cache!(path)
326326
end
327327

328328
def has_app_cache?
329-
cached_revision && super
329+
locked_revision && super
330330
end
331331

332332
def use_app_cache?
333333
has_app_cache? && !local?
334334
end
335335

336336
def requires_checkout?
337-
allow_git_ops? && !local? && !cached_revision_checked_out?
337+
allow_git_ops? && !local? && !locked_revision_checked_out?
338338
end
339339

340-
def cached_revision_checked_out?
341-
cached_revision && cached_revision == revision && install_path.exist?
340+
def locked_revision_checked_out?
341+
locked_revision && locked_revision == revision && install_path.exist?
342342
end
343343

344344
def base_name
@@ -375,7 +375,7 @@ def uri_hash
375375
Bundler::Digest.sha1(input)
376376
end
377377

378-
def cached_revision
378+
def locked_revision
379379
options["revision"]
380380
end
381381

@@ -384,7 +384,7 @@ def cached?
384384
end
385385

386386
def git_proxy
387-
@git_proxy ||= GitProxy.new(cache_path, uri, options, cached_revision, self)
387+
@git_proxy ||= GitProxy.new(cache_path, uri, options, locked_revision, self)
388388
end
389389

390390
def fetch

0 commit comments

Comments
 (0)