Skip to content

Commit 97f137d

Browse files
authored
Fix listed primary workspace fallback (#636)
1 parent 0d68ae0 commit 97f137d

1 file changed

Lines changed: 21 additions & 21 deletions

File tree

tests/smoke-workspace-local-fallback.php

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function show( string $handle ): \WP_Error
3333
self::$show_input = compact('handle');
3434
return new \WP_Error(
3535
'remote_workspace_repo_not_found',
36-
'Remote workspace repository "homeboy" is not registered. Call workspace_clone first.'
36+
'Remote workspace repository "wpcom-codebox" is not registered. Call workspace_clone first.'
3737
);
3838
}
3939

@@ -42,7 +42,7 @@ public function worktree_add( string $repo_name, string $branch, ?string $from =
4242
self::$worktree_input = compact('repo_name', 'branch', 'from');
4343
return new \WP_Error(
4444
'remote_workspace_repo_not_found',
45-
'Remote workspace repository "homeboy" is not registered. Call workspace_clone first.'
45+
'Remote workspace repository "wpcom-codebox" is not registered. Call workspace_clone first.'
4646
);
4747
}
4848
}
@@ -62,7 +62,7 @@ public function show_repo( string $handle ): array
6262
'is_worktree' => false,
6363
'path' => '/Users/chubes/Developer/' . $handle,
6464
'branch' => 'main',
65-
'remote' => 'https://github.com/Extra-Chill/homeboy.git',
65+
'remote' => 'git@github.a8c.com:Automattic/wpcom-codebox.git',
6666
'commit' => 'abc123 listed primary',
6767
'dirty' => 0,
6868
);
@@ -148,35 +148,35 @@ function is_wp_error( $value ): bool
148148

149149
$show = \DataMachineCode\Abilities\WorkspaceAbilities::showRepo(
150150
array(
151-
'name' => 'homeboy',
151+
'name' => 'wpcom-codebox',
152152
)
153153
);
154154

155-
$assert('remote show attempted first', 'homeboy' === ( \DataMachineCode\Workspace\RemoteWorkspaceBackend::$show_input['handle'] ?? '' ));
156-
$assert('local show fallback attempted', 'homeboy' === ( \DataMachineCode\Workspace\Workspace::$show_input['handle'] ?? '' ));
157-
$assert('show returns local listed primary', is_array($show) && '/Users/chubes/Developer/homeboy' === ( $show['path'] ?? '' ));
155+
$assert('remote show attempted first', 'wpcom-codebox' === ( \DataMachineCode\Workspace\RemoteWorkspaceBackend::$show_input['handle'] ?? '' ));
156+
$assert('local show fallback attempted', 'wpcom-codebox' === ( \DataMachineCode\Workspace\Workspace::$show_input['handle'] ?? '' ));
157+
$assert('show returns local listed primary', is_array($show) && '/Users/chubes/Developer/wpcom-codebox' === ( $show['path'] ?? '' ));
158158

159159
$worktree = \DataMachineCode\Abilities\WorkspaceAbilities::worktreeAdd(
160160
array(
161-
'repo' => 'homeboy',
162-
'branch' => 'fix/issue-4072-artifact-viewer-urls',
163-
'from' => 'origin/main',
164-
'inject_context' => false,
165-
'bootstrap' => false,
166-
'allow_stale' => true,
167-
'rebase_base' => true,
168-
'force' => true,
169-
'task_url' => 'https://github.com/Extra-Chill/homeboy/issues/4072',
170-
'task_ref' => 'Extra-Chill/homeboy#4072',
161+
'repo' => 'wpcom-codebox',
162+
'branch' => 'fix/listed-primary-resolution',
163+
'from' => 'origin/main',
164+
'inject_context' => false,
165+
'bootstrap' => false,
166+
'allow_stale' => true,
167+
'rebase_base' => true,
168+
'force' => true,
169+
'task_url' => 'https://github.com/Extra-Chill/data-machine-code/issues/635',
170+
'task_ref' => 'Extra-Chill/data-machine-code#635',
171171
)
172172
);
173173

174-
$assert('remote worktree add attempted first', 'homeboy' === ( \DataMachineCode\Workspace\RemoteWorkspaceBackend::$worktree_input['repo_name'] ?? '' ));
175-
$assert('local worktree add fallback attempted', 'homeboy' === ( \DataMachineCode\Workspace\Workspace::$worktree_input['repo'] ?? '' ));
174+
$assert('remote worktree add attempted first', 'wpcom-codebox' === ( \DataMachineCode\Workspace\RemoteWorkspaceBackend::$worktree_input['repo_name'] ?? '' ));
175+
$assert('local worktree add fallback attempted', 'wpcom-codebox' === ( \DataMachineCode\Workspace\Workspace::$worktree_input['repo'] ?? '' ));
176176
$assert('worktree add preserves base ref', 'origin/main' === ( \DataMachineCode\Workspace\Workspace::$worktree_input['from'] ?? '' ));
177177
$assert('worktree add preserves local options', false === ( \DataMachineCode\Workspace\Workspace::$worktree_input['inject_context'] ?? null ) && true === ( \DataMachineCode\Workspace\Workspace::$worktree_input['allow_stale'] ?? null ));
178-
$assert('worktree add preserves task metadata', 'Extra-Chill/homeboy#4072' === ( \DataMachineCode\Workspace\Workspace::$worktree_input['task']['task_ref'] ?? '' ));
179-
$assert('worktree add returns local worktree result', is_array($worktree) && 'homeboy@fix-issue-4072-artifact-viewer-urls' === ( $worktree['handle'] ?? '' ));
178+
$assert('worktree add preserves task metadata', 'Extra-Chill/data-machine-code#635' === ( \DataMachineCode\Workspace\Workspace::$worktree_input['task']['task_ref'] ?? '' ));
179+
$assert('worktree add returns local worktree result', is_array($worktree) && 'wpcom-codebox@fix-listed-primary-resolution' === ( $worktree['handle'] ?? '' ));
180180

181181
if ( $failures ) {
182182
echo "\nFailures:\n";

0 commit comments

Comments
 (0)