ruby_workspace_manager 0.6.5 → 0.6.6

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: 115ec9332203fbf44622ec26f179450eb6dcabce1bb9ad7a523bd6cd470b7cdd
4
- data.tar.gz: 4d0c0fc8898f786091a86634408b018a236bcfcb772589b30e917bc5d6ece7c0
3
+ metadata.gz: 37763589fe851ae20d97ffdb9f44a5d4a67ffd90d9629f474eaa44a9840d3b50
4
+ data.tar.gz: 82f8a67c8bc0b27b9543dff8dd83957c02b8c91e071d9b14c8f5d286007a3398
5
5
  SHA512:
6
- metadata.gz: b0a671c6a7b4e2a66f6120f7a2c635e52e2c9715312fe2b576a298a89878be4ee66f38758e3cbeb1fd865e7c5083ffd10e936d1041fabc10125e807e218b7947
7
- data.tar.gz: a787011658b8f986c0b2353fffc97938978113cfd9e549f6d6a8287034a5ae575456661507dde36a4a01e7fc05957bcedb8db381bdc4ef5acb2f925782d874a0
6
+ metadata.gz: f93674a08b41f77222a254d557ae4186a51b9ede26026fe6e6e967277a161ecdcd99c4f61bab9d03ec5597f9d66707e93efb319dab5b6c90bc3ebb24f4dd73ed
7
+ data.tar.gz: a275f438dd04b589f763ee122bce26a5be3035e0c1c64a1099863c8b9dcb3184337f0e9195b889d46df11a328b30de3de621b45243f142e1ab6d552b00d812f8
@@ -24,7 +24,9 @@ module Rwm
24
24
  @graph = graph
25
25
  @committed_only = committed_only
26
26
  @base_branch = base_branch || detect_base_branch
27
- validate_base_branch! if base_branch
27
+ # Validate the *resolved* base, auto-detected or explicit. An unreachable base
28
+ # must fail loudly rather than silently report "nothing affected" (false-green CI).
29
+ validate_base_branch!
28
30
  end
29
31
 
30
32
  # Returns packages directly changed + their transitive dependents
@@ -91,10 +93,21 @@ module Rwm
91
93
  def detect_changed_files
92
94
  files = Set.new
93
95
 
94
- # 1. Committed changes: base branch vs HEAD
96
+ # 1. Committed changes: base branch vs HEAD. A failure here means we cannot
97
+ # compare against the base (e.g. a shallow clone whose merge-base is below the
98
+ # fetched boundary). That must be loud — a silent empty result false-greens CI.
95
99
  Rwm.debug("affected: git diff --name-only #{base_branch}...HEAD")
96
- committed, _, status = Open3.capture3("git", "-C", workspace.root, "diff", "--name-only", "#{base_branch}...HEAD")
97
- committed.lines.each { |l| files << l.chomp } if status.success?
100
+ committed, committed_err, status = Open3.capture3("git", "-C", workspace.root, "diff", "--name-only", "#{base_branch}...HEAD")
101
+ unless status.success?
102
+ raise Rwm::InvalidBaseRefError.new(
103
+ base_branch,
104
+ reason: "Could not compute changes against base '#{base_branch}': " \
105
+ "git diff #{base_branch}...HEAD failed (#{committed_err.strip}). " \
106
+ "If this is a shallow clone, fetch more history " \
107
+ "(e.g. `git fetch origin #{base_branch} --unshallow`) or pass a valid --base."
108
+ )
109
+ end
110
+ committed.lines.each { |l| files << l.chomp }
98
111
 
99
112
  unless @committed_only
100
113
  # 2. Staged changes (not yet committed)
data/lib/rwm/errors.rb CHANGED
@@ -42,8 +42,8 @@ module Rwm
42
42
  class BootstrapError < Error; end
43
43
 
44
44
  class InvalidBaseRefError < Error
45
- def initialize(ref)
46
- super("Base ref '#{ref}' does not exist. Check the branch name or pass a valid --base ref.")
45
+ def initialize(ref, reason: nil)
46
+ super(reason || "Base ref '#{ref}' does not exist. Check the branch name or pass a valid --base ref.")
47
47
  end
48
48
  end
49
49
 
data/lib/rwm/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rwm
4
- VERSION = "0.6.5"
4
+ VERSION = "0.6.6"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_workspace_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.5
4
+ version: 0.6.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Siddharth Bhatt
@@ -85,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
85
  - !ruby/object:Gem::Version
86
86
  version: '0'
87
87
  requirements: []
88
- rubygems_version: 4.0.6
88
+ rubygems_version: 4.0.12
89
89
  specification_version: 4
90
90
  summary: Ruby Workspace Manager — an Nx-like monorepo tool for Ruby
91
91
  test_files: []