carson 4.3.5 → 4.4.0

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: f75abd3dbe087565ec4338de23c0b6ca0e5a3269dd217deebfd4e13653e9cc71
4
- data.tar.gz: bdfd8b3c61839f93d1424d28b94d3314a1a6f07158b961e2a4f04cbcedf5f6de
3
+ metadata.gz: b22cfd5f4976a5367d0a815fac4f360049673aaa585a3783c7296f155be896a9
4
+ data.tar.gz: bdc3f70b4b74dcb489b8dde16ca0244846b4082fc6697713ce83490cb64319c4
5
5
  SHA512:
6
- metadata.gz: f90470bef8509ee72e7dfffc57463f7c6fcb10918ee3e4b9a5af72698302edfa7c4259971d23ff50225e63d2a5900fa05f8308b296c56316f88ae903ed5f276d
7
- data.tar.gz: a115dd2f198afd4f014165588e476538137611aea3186599d539fb65ac7eccfc13f3fcd920e2786597ba0dec4ce7a1a2339d81af59158cd4337032c5c2e59990
6
+ metadata.gz: a77aa24657d4863d5de2a06e14b14e0f339cd9b9ac709933f2b2ec084de721a101781867a7b3a4bb0557623968247ca4333cf5821660778ce0ddd70c20f780ba
7
+ data.tar.gz: 5113678e26302f1eb7b9a5c93e59f4a357434ddade3ec9b4eec00f412c1af8b77888b132ab5f849594e04621d0af57e8e9969f3e0292b23b18bb215894a1dac9
data/RELEASE.md CHANGED
@@ -7,6 +7,17 @@ Release-note scope rule:
7
7
 
8
8
  ## Unreleased
9
9
 
10
+ ## 4.4.0
11
+
12
+ ### New
13
+
14
+ - **Auto-chdir on checkout from inside worktree.** `carson checkout` no longer blocks when the current working directory is inside the worktree being removed. Carson `Dir.chdir`s to the main worktree root and completes the removal automatically. Both the warehouse (`assess_removal`) and legacy (`remove_check`) paths are fixed.
15
+ - **Parent shell excluded from held-by-other-process check.** `held_by_other_process?` now excludes `Process.ppid` (the user's shell that launched Carson) in addition to `Process.pid`. Prevents false blocks when the user runs `carson checkout` from inside the worktree.
16
+
17
+ ### Why
18
+
19
+ Running `carson checkout` from inside the target worktree is the most natural invocation — agents and users are already there. Blocking and printing a recovery command added friction for no safety benefit, since Carson can move its own process out.
20
+
10
21
  ## 4.3.5
11
22
 
12
23
  ### Fixed
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.3.5
1
+ 4.4.0
@@ -232,11 +232,8 @@ module Carson
232
232
  return { status: :ok, missing: true }
233
233
  end
234
234
 
235
- if workbench.holds_cwd?
236
- return { status: :block, result_status: "block",
237
- error: "current working directory is inside this worktree",
238
- recovery: "cd #{main_worktree_root} && carson checkout #{File.basename( workbench.path )}" }
239
- end
235
+ # Auto-chdir out so removal can proceed.
236
+ Dir.chdir( main_worktree_root ) if workbench.holds_cwd?
240
237
 
241
238
  if workbench.held_by_other_process?
242
239
  return { status: :block, result_status: "block",
@@ -270,18 +270,8 @@ module Carson
270
270
  entry = find( path: resolved_path, runtime: runtime )
271
271
  branch = entry&.branch
272
272
 
273
- if entry&.holds_cwd?
274
- safe_root = runtime.main_worktree_root
275
- return {
276
- status: :block,
277
- result_status: "block",
278
- exit_code: Runtime::EXIT_BLOCK,
279
- resolved_path: resolved_path,
280
- branch: branch,
281
- error: "current working directory is inside this worktree",
282
- recovery: "cd #{safe_root} && carson checkout #{File.basename( resolved_path )}"
283
- }
284
- end
273
+ # Auto-chdir out so removal can proceed.
274
+ Dir.chdir( runtime.main_worktree_root ) if entry&.holds_cwd?
285
275
 
286
276
  if entry&.held_by_other_process?
287
277
  return {
@@ -388,11 +378,12 @@ module Carson
388
378
  return false if stdout.nil? || stdout.empty?
389
379
 
390
380
  normalised = File.join( canonical, "" )
391
- my_pid = Process.pid
381
+ # Exclude this process and its parent (the user's shell that launched Carson).
382
+ excluded_pids = [ Process.pid, Process.ppid ].to_set
392
383
  stdout.lines.drop( 1 ).any? do |line|
393
384
  fields = line.strip.split( /\s+/ )
394
385
  next false unless fields.length >= 9
395
- next false if fields[ 1 ].to_i == my_pid
386
+ next false if excluded_pids.include?( fields[ 1 ].to_i )
396
387
  name = fields[ 8.. ].join( " " )
397
388
  name == canonical || name.start_with?( normalised )
398
389
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carson
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.5
4
+ version: 4.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hailei Wang