Skip to content

Commit 927fa4c

Browse files
committed
Document the OVERRIDES rule in the gem restore
Assisted-by: Claude Code:claude-opus-5-5
1 parent 26062a3 commit 927fa4c

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

  • crates/socket-patch-core/src/patch/redirect/upstream

‎crates/socket-patch-core/src/patch/redirect/upstream/gem.rs‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@
4747
//! rewriter could not have written in place (a blank line before it —
4848
//! the in-place match swallows every blank line before the declaration,
4949
//! and the append always writes one; it goes with the block) that
50-
//! another locked spec depends on. Otherwise the gem is kept as a
50+
//! another locked spec depends on (a spec sub-line, or a Bundler 4.1
51+
//! `OVERRIDES` `with:` target, #1989). Otherwise the gem is kept as a
5152
//! direct pin: a stray exact pin installs the same bytes, while dropping
5253
//! a real declaration would stop `Bundler.require` loading the gem.
5354
//! * a `CHECKSUMS` entry the rewriter ADDED is only recognizable next to
@@ -190,7 +191,11 @@ fn override_targets<'l>(lines: &'l [&'l str]) -> impl Iterator<Item = &'l str> +
190191
let range = named_section(lines, "OVERRIDES").unwrap_or((0, 0));
191192
lines[range.0..range.1].iter().filter_map(|l| {
192193
let entry = indented(l, 2)?.trim_end();
193-
// Gem names hold no `"` or `,`, so each `, ` starts a new argument.
194+
// Bundler writes `"<target>", with: "<gem>", in: "<parent>"`
195+
// (`Override#to_lock`: `inspect`ed values joined by `, `). A
196+
// `version:` value may itself hold `, `, so splitting on it can
197+
// break that value apart, but never the `with:` one: a gem name
198+
// holds no `"`, `,` or space.
194199
entry.split(", ").find_map(|arg| {
195200
arg.strip_prefix("with: \"")?
196201
.strip_suffix('"')

0 commit comments

Comments
 (0)