lib/pdk/util/git.rb in pdk-1.14.0 vs lib/pdk/util/git.rb in pdk-1.14.1
- old
+ new
@@ -1,5 +1,7 @@
+require 'pdk'
+
module PDK
module Util
class GitError < StandardError
attr_reader :stdout
attr_reader :stderr
@@ -106,10 +108,10 @@
raise PDK::CLI::ExitWithError, _('Unable to access the template repository "%{repository}"') % {
repository: repo,
}
end
- matching_refs = output[:stdout].split("\n").map { |r| r.split("\t") }
+ matching_refs = output[:stdout].split(%r{\r?\n}).map { |r| r.split("\t") }
matching_ref = matching_refs.find { |_sha, remote_ref| remote_ref == "refs/tags/#{ref}" || remote_ref == "refs/remotes/origin/#{ref}" || remote_ref == "refs/heads/#{ref}" }
raise PDK::CLI::ExitWithError, _('Unable to find a branch or tag named "%{ref}" in %{repo}') % { ref: ref, repo: repo } if matching_ref.nil?
matching_ref.first
end