dependabot-common 0.342.1 → 0.342.2

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: b614a0d6fac738013befc606454b555c574a12a05d560d940b64f119ddd995d9
4
- data.tar.gz: 472c1e8dc3f032c5d44b3f262328b09ff336bae36f8935286c0d9ff95094b4e7
3
+ metadata.gz: 119ca0f68304d844107397afffa3ad2e46c139a787e8c96e5ca954e367bf7359
4
+ data.tar.gz: c7ced6c43c2ab909541c71e513d4774e036f8408d3f7220069e17dff776e8ffe
5
5
  SHA512:
6
- metadata.gz: 3c99d2cfcefd567dc585079bf52f23955a4ce5eef30754c00c27f6ce6fa9e4bddad6bc7d97466ef8c100d12780a9fce959a5c5aa176812f05408bd84d8e22bfb
7
- data.tar.gz: 536014a02a2d59819e339563e9227a710f97c731eaf595521a757f6a6ae1878109ba9d76fa2ec9c94da1a5d57216b835c7538e0e019388c03cf545c4ffeb07ff
6
+ metadata.gz: 11d3e8185b084316449bc004ef25a3653081719fbb9dbe7c340aaaafa8dab9f2caefce2277ba260fae4c0f9f894d7c4ec3fda7d59ea80a544b4729c41c490fd8
7
+ data.tar.gz: 4b8c05569a0fa3a8a9778f3e488f0f3c4908787e327dd77a18fb4e4ba20eb2426c58b0fe62b544f38dec650e8f3b0ea5483fe89d838c27a77c732d8e7047d68d
@@ -27,6 +27,9 @@ module Dependabot
27
27
  )$
28
28
  /ix
29
29
 
30
+ # String pattern for matching version tags with optional prefixes (e.g., "v1.2.3" matches "1.2.3")
31
+ VERSION_TAG_MATCH_PATTERN = "(?:[^0-9\\.]|\\A)%s\\z"
32
+
30
33
  sig do
31
34
  params(
32
35
  dependency: Dependabot::Dependency,
@@ -72,9 +75,7 @@ module Dependabot
72
75
  return false if branch == ref
73
76
  return true if branch
74
77
  return true if dependency.version&.start_with?(T.must(ref))
75
-
76
- # If the specified `ref` is actually a tag, we're pinned
77
- return true if local_upload_pack&.match?(%r{ refs/tags/#{ref}$})
78
+ return true if ref_matches_tag?
78
79
 
79
80
  # Assume we're pinned unless the specified `ref` is actually a branch
80
81
  return true unless local_upload_pack&.match?(%r{ refs/heads/#{ref}$})
@@ -280,6 +281,22 @@ module Dependabot
280
281
  max_local_tag(select_lower_precision(tags))
281
282
  end
282
283
 
284
+ # Check if the current ref matches any Git tag (handling version tag prefixes)
285
+ sig { returns(T::Boolean) }
286
+ def ref_matches_tag?
287
+ return false unless ref
288
+
289
+ # Handle tag prefixes (e.g., v0.0.13 for ref 0.0.13) by checking if any local tag matches the version
290
+ if version_tag?(T.must(ref)) && local_tags.any? do |tag|
291
+ tag.name =~ Regexp.new(VERSION_TAG_MATCH_PATTERN % Regexp.escape(T.must(ref)))
292
+ end
293
+ return true
294
+ end
295
+
296
+ # Fallback to exact match for non-version refs
297
+ local_upload_pack&.match?(%r{ refs/tags/#{ref}$}) || false
298
+ end
299
+
283
300
  # Find the latest version with the same precision as the pinned version.
284
301
  sig { params(tags: T::Array[Dependabot::GitRef]).returns(T::Array[Dependabot::GitRef]) }
285
302
  def select_matching_existing_precision(tags)
@@ -524,7 +541,7 @@ module Dependabot
524
541
  sig { params(version: String).returns(T.nilable(String)) }
525
542
  def listing_tag_for_version(version)
526
543
  listing_tags
527
- .find { |t| t.name =~ /(?:[^0-9\.]|\A)#{Regexp.escape(version)}\z/ }
544
+ .find { |t| t.name =~ Regexp.new(VERSION_TAG_MATCH_PATTERN % Regexp.escape(version)) }
528
545
  &.name
529
546
  end
530
547
 
data/lib/dependabot.rb CHANGED
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Dependabot
5
- VERSION = "0.342.1"
5
+ VERSION = "0.342.2"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-common
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.342.1
4
+ version: 0.342.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
@@ -629,7 +629,7 @@ licenses:
629
629
  - MIT
630
630
  metadata:
631
631
  bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
632
- changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.342.1
632
+ changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.342.2
633
633
  rdoc_options: []
634
634
  require_paths:
635
635
  - lib