lib/bundler/source/git.rb in bundler-2.2.28 vs lib/bundler/source/git.rb in bundler-2.2.29
- old
+ new
@@ -40,11 +40,11 @@
out << " remote: #{@uri}\n"
out << " revision: #{revision}\n"
%w[ref branch tag submodules].each do |opt|
out << " #{opt}: #{options[opt]}\n" if options[opt]
end
- out << " glob: #{@glob}\n" unless @glob == DEFAULT_GLOB
+ out << " glob: #{@glob}\n" unless default_glob?
out << " specs:\n"
end
def hash
[self.class, uri, ref, branch, name, version, glob, submodules].hash
@@ -73,16 +73,24 @@
ref
else
git_proxy.branch
end
- rev = " (at #{at}@#{shortref_for_display(revision)})"
+ rev = "at #{at}@#{shortref_for_display(revision)}"
rescue GitError
""
end
- "#{@safe_uri}#{rev}"
+ specifiers = [rev, glob_for_display].compact
+ suffix =
+ if specifiers.any?
+ " (#{specifiers.join(", ")})"
+ else
+ ""
+ end
+
+ "#{@safe_uri}#{suffix}"
end
def name
File.basename(@uri, ".git")
end
@@ -278,9 +286,17 @@
ref[0..6]
end
def shortref_for_path(ref)
ref[0..11]
+ end
+
+ def glob_for_display
+ default_glob? ? nil : "glob: #{@glob}"
+ end
+
+ def default_glob?
+ @glob == DEFAULT_GLOB
end
def uri_hash
if uri =~ %r{^\w+://(\w+@)?}
# Downcase the domain component of the URI