lib/bundler/source/git.rb in bundler-2.2.4 vs lib/bundler/source/git.rb in bundler-2.2.5
- old
+ new
@@ -20,11 +20,11 @@
%w[ref branch tag revision].each {|k| options[k] = options[k].to_s if options[k] }
@uri = options["uri"] || ""
@safe_uri = URICredentialsFilter.credential_filtered_uri(@uri)
@branch = options["branch"]
- @ref = options["ref"] || options["branch"] || options["tag"] || "master"
+ @ref = options["ref"] || options["branch"] || options["tag"]
@submodules = options["submodules"]
@name = options["name"]
@version = options["version"].to_s.strip.gsub("-", ".pre.")
@copied = false
@@ -58,28 +58,30 @@
end
alias_method :==, :eql?
def to_s
- at = if local?
- path
- elsif user_ref = options["ref"]
- if ref =~ /\A[a-z0-9]{4,}\z/i
- shortref_for_display(user_ref)
+ begin
+ at = if local?
+ path
+ elsif user_ref = options["ref"]
+ if ref =~ /\A[a-z0-9]{4,}\z/i
+ shortref_for_display(user_ref)
+ else
+ user_ref
+ end
+ elsif ref
+ ref
else
- user_ref
+ git_proxy.branch
end
- else
- ref
+
+ rev = " (at #{at}@#{shortref_for_display(revision)})"
+ rescue GitError
+ ""
end
- rev = begin
- "@#{shortref_for_display(revision)}"
- rescue GitError
- nil
- end
-
- "#{@safe_uri} (at #{at}#{rev})"
+ "#{@safe_uri}#{rev}"
end
def name
File.basename(@uri, ".git")
end