dependabot-common 0.106.38 → 0.106.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec5fad87ccbb53803055b87daa43e794c16f6cfce5718d294eec76e54c9e8ae7
4
- data.tar.gz: c1f30794da5a888b6a467c5f7f114dc4b438a864be34a986bcaae0e53ad6ffc5
3
+ metadata.gz: fa2c92c266b4750d28e0b7a9f8cab6b587c2a7fe250649ae37921ac3180e15a6
4
+ data.tar.gz: fc8da7b5841ea09f87052ada232dd4ffdbaff7c870f61d5d43f60b21898735e1
5
5
  SHA512:
6
- metadata.gz: 7df25b052cd32459ca0ef0bb8f32866bf3bb843eed0da9187ba0085b84c9ed34a957843b13d004bbac70f61f21f62a0723c700e4df2f3d8046c11ee99e981552
7
- data.tar.gz: 6b79f8456928e87b42f91e66b41c50dfbb8d0ea30a2b5784093a5d0d1138228a6704897e33a3652db395b3fa7112cd0716d46038f2927b44c4d37588408b849e
6
+ metadata.gz: a48c6d09c14c204ab6741a80b0fa731a8fc2c64ce97e65b03369e7d4f7dff02ea1d6304d0f258b8a9f5e7370666d1c0ea6adfd9dad7b76d2eeddaed2e860ff5e
7
+ data.tar.gz: a65b102d1d70ff76c203f7f6bd9afd15cb61ad8ddff1f83ad3d776680a052e4f7ab2163fb506824d6ec8fb8f8d27c3c0be01ae8917cdaa8c3a4cc8b5b36280dc
@@ -22,6 +22,14 @@ module Dependabot
22
22
  @tags ||= tags_for_upload_pack(upload_pack)
23
23
  end
24
24
 
25
+ def ref_names
26
+ @ref_names ||=
27
+ upload_pack.lines.
28
+ select { |l| l.split(" ")[-1].start_with?("refs/tags", "refs/heads") }.
29
+ map { |line| line.split(%r{ refs/(tags|heads)/}).last.strip }.
30
+ reject { |l| l.end_with?("^{}") }
31
+ end
32
+
25
33
  private
26
34
 
27
35
  attr_reader :url, :credentials
@@ -62,18 +62,11 @@ module Dependabot
62
62
  end
63
63
 
64
64
  def branch_exists?(name)
65
- @branch_ref ||= {}
66
- @branch_ref[name] ||=
67
- github_client_for_source.ref(source.repo, "heads/#{name}")
65
+ git_metadata_fetcher.ref_names.include?(name)
66
+ rescue Dependabot::GitDependenciesNotReachable
67
+ raise "Unexpected git error!" if repo_exists?
68
68
 
69
- if @branch_ref[name].is_a?(Array)
70
- @branch_ref[name].any? { |r| r.ref == "refs/heads/#{name}" }
71
- else
72
- @branch_ref[name].ref == "refs/heads/#{name}"
73
- end
74
- rescue Octokit::NotFound
75
- @branch_ref[name] = []
76
- false
69
+ raise RepoNotFound, source.url
77
70
  end
78
71
 
79
72
  def pull_request_exists?
@@ -281,6 +274,14 @@ module Dependabot
281
274
  github_client_for_source.repository(source.repo).default_branch
282
275
  end
283
276
 
277
+ def git_metadata_fetcher
278
+ @git_metadata_fetcher ||=
279
+ GitMetadataFetcher.new(
280
+ url: source.url,
281
+ credentials: credentials
282
+ )
283
+ end
284
+
284
285
  def commit_signature(tree, author_details_with_date)
285
286
  CommitSigner.new(
286
287
  author_details: author_details_with_date,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dependabot
4
- VERSION = "0.106.38"
4
+ VERSION = "0.106.39"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-common
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.106.38
4
+ version: 0.106.39
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-08 00:00:00.000000000 Z
11
+ date: 2019-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-ecr