@@ -321,6 +321,9 @@ function () use ( $tmp ): void {
321321 $ run ('git add README.md ' , $ primary );
322322 $ run ('git commit -m initial ' , $ primary );
323323 $ run ('git remote add origin https://github.com/acme/demo.git ' , $ primary );
324+ $ linked_primary = DATAMACHINE_WORKSPACE_PATH . '/linked-primary ' ;
325+ $ run ('git worktree add ../linked-primary -b linked-primary HEAD ' , $ primary );
326+ $ assert (true , is_file ($ linked_primary . '/.git ' ), 'linked primary fixture uses a .git file ' );
324327 // Synthetic runtime registration so the env-driven session capture has a
325328 // runtime to scan. DMC enumerates no runtime IDs itself — the integration
326329 // layer (here, the test) declares them via the public filter.
@@ -334,6 +337,9 @@ function () use ( $tmp ): void {
334337
335338 $ ws = new \DataMachineCode \Workspace \Workspace ();
336339 $ GLOBALS ['wpdb ' ] = new DatamachineCodeLifecycleInventoryWpdb ();
340+ $ linked_list = $ ws ->worktree_list ('linked-primary ' , null , array ( 'include_status ' => false , 'include_disk ' => false ));
341+ $ linked_items = array_values (array_filter ($ linked_list ['worktrees ' ] ?? array (), fn ( $ wt ) => ( $ wt ['handle ' ] ?? '' ) === 'linked-primary ' ));
342+ $ assert (1 , count ($ linked_items ), 'worktree_list discovers primary checkouts whose .git is a file ' );
337343
338344 $ GLOBALS ['datamachine_code_test_filters ' ]['datamachine_worktree_disk_budget_thresholds ' ] = function ( array $ thresholds ): array {
339345 $ thresholds ['refuse_free_bytes ' ] = PHP_INT_MAX ;
0 commit comments