dragnet 5.4.1 → 5.4.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: e401f3864f8d30d24e60a21ad9d8751e6be22cf0b82e8defecd49e3b019bd9f3
4
- data.tar.gz: ad197e8038918748dd9deee612a89acdfe99f12776e56bf6bdb9f105139659c5
3
+ metadata.gz: 0afbf1f0898c9d691cefe979ea56584e95e53e906fb51a8e2a08fd791a315692
4
+ data.tar.gz: 1bf496f3e00cd91eb73e884c1784cc360c4aed4941ae2e6b31f9de920b51e15d
5
5
  SHA512:
6
- metadata.gz: 93c72bfe1da3aaf68bc674953ff8201a99a6f1fbc5677e401ca215c0d005641b782634fdb5b9225b321601fae6642802275094b781d2549b695d096b2f896999
7
- data.tar.gz: 2243730c112f9319941b95939b424f83b1be678b51d3fe90276c6a577d6a156c270583818dc9971fde2cda98984694c0751d4b04383e5e11b074cc63f38dd653
6
+ metadata.gz: d56cb80c40e58f608b32eeda1b3e24b4fa7b95b5c572e62dc25e9e98c6a57f6e147170905e9e84f0fd41215849c57cdd484b9812f9383a3c922af5c63b7f5e4e
7
+ data.tar.gz: 98ac6e7a2efc349c2dedd5b321c2bb2ed1e3d3f6300b61d8241b682d382446efee560d1068036fae1b59b52d2eb75c0d8b13ceaae41613138f75b2dc80f36c8f
data/CHANGELOG.md CHANGED
@@ -8,6 +8,11 @@ Please mark backwards incompatible changes with an exclamation mark at the start
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [5.4.2] - 2025-05-22
12
+
13
+ ### Fixed
14
+ - Dragnet no longer crashes when an invalid / non-existing SHA1 is used in a MTR.
15
+
11
16
  ## [5.4.1] - 2025-04-23
12
17
 
13
18
  ### Fixed
@@ -1,12 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative '../verification_result'
4
+ require_relative 'mixins/git_error_handling'
4
5
  require_relative 'repository_verifier'
5
6
 
6
7
  module Dragnet
7
8
  module Verifiers
8
9
  # Checks for changes in the repository since the creation of the MTR Record
9
10
  class ChangesVerifier < Dragnet::Verifiers::RepositoryVerifier
11
+ include ::Dragnet::Verifiers::Mixins::GitErrorHandling
12
+
10
13
  attr_reader :test_records
11
14
 
12
15
  # @param [Dragnet::TestRecord] test_record The +TestRecord+ object to
@@ -33,6 +36,8 @@ module Dragnet
33
36
  return unless diff.size.positive?
34
37
 
35
38
  find_changes(diff)
39
+ rescue Git::FailedError => e
40
+ result_from_git_error(e)
36
41
  end
37
42
 
38
43
  private
@@ -44,7 +49,7 @@ module Dragnet
44
49
  # the details of the changes found in the repository, or +nil+ if no
45
50
  # changes were found.
46
51
  def find_changes(diff)
47
- diff.stats[:files].each do |file, _changes|
52
+ diff.stats[:files].each_key do |file|
48
53
  next if mtr_files.include?(file) # Changes to MTR files are ignored.
49
54
 
50
55
  return Dragnet::VerificationResult.new(
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative '../verification_result'
4
+ require_relative 'mixins/git_error_handling'
4
5
  require_relative 'repository_verifier'
5
6
 
6
7
  module Dragnet
@@ -8,6 +9,8 @@ module Dragnet
8
9
  # Checks if any of the files listed in the MTR have changed since the MTR
9
10
  # was created.
10
11
  class FilesVerifier < Dragnet::Verifiers::RepositoryVerifier
12
+ include ::Dragnet::Verifiers::Mixins::GitErrorHandling
13
+
11
14
  # Executes the verification process.
12
15
  # Checks the changes in the repository. If a change in one of the files
13
16
  # is detected a +:result+ key is added to the MTR, including the detected
@@ -26,6 +29,8 @@ module Dragnet
26
29
  end
27
30
 
28
31
  result_from(changes) if changes.any?
32
+ rescue Git::FailedError => e
33
+ result_from_git_error(e)
29
34
  end
30
35
 
31
36
  private
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dragnet
4
+ module Verifiers
5
+ module Mixins
6
+ # A mixin that provides methods to gracefully handle errors during Git's
7
+ # execution.
8
+ module GitErrorHandling
9
+ private
10
+
11
+ # @param [Git::FailedError] error The error that occurred during the
12
+ # verification.
13
+ # @return [Dragnet::VerificationResult] A +VerificationResult+ object that
14
+ # encapsulates the occurred error so that it can be presented to the
15
+ # user.
16
+ def result_from_git_error(error)
17
+ Dragnet::VerificationResult.new(
18
+ status: :failed,
19
+ reason: "Unable to diff the revisions: #{shorten_sha1(sha1)}..#{shorten_sha1(repository.head.sha)}: " \
20
+ "#{error.result.stdout}"
21
+ )
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dragnet
4
- VERSION = '5.4.1'
4
+ VERSION = '5.4.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dragnet
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.4.1
4
+ version: 5.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ESR Labs GmbH
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-04-23 00:00:00.000000000 Z
11
+ date: 2025-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -155,6 +155,7 @@ files:
155
155
  - lib/dragnet/verifiers.rb
156
156
  - lib/dragnet/verifiers/changes_verifier.rb
157
157
  - lib/dragnet/verifiers/files_verifier.rb
158
+ - lib/dragnet/verifiers/mixins/git_error_handling.rb
158
159
  - lib/dragnet/verifiers/repos_verifier.rb
159
160
  - lib/dragnet/verifiers/repository_verifier.rb
160
161
  - lib/dragnet/verifiers/result_verifier.rb