You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
returnnew \WP_Error('invalid_repo', 'Repository name is required.', array( 'status' => 400 ));
423
+
}
424
+
425
+
if ( str_contains($repo, '@') && ! $this->looks_like_git_url($repo) ) {
426
+
returnnew \WP_Error('invalid_repo', 'Worktree handles cannot be used where a primary repository is required.', array( 'status' => 400 ));
427
+
}
428
+
429
+
if ( $this->looks_like_git_url($repo) ) {
430
+
$existing = $this->find_primary_by_remote($repo);
431
+
if ( null !== $existing ) {
432
+
return$existing['name'];
433
+
}
434
+
435
+
returnnew \WP_Error('unsupported_workspace_repo_argument', sprintf('Repository URL "%s" does not match an existing local primary checkout. Use a registered primary handle or run workspace clone first.', $repo), array( 'status' => 404 ));
if ( str_contains($repo, '/') || str_contains($repo, '\\') ) {
443
+
returnnew \WP_Error('unsupported_workspace_repo_argument', sprintf('Repository argument "%s" is not a primary workspace handle. Use the local primary handle, or pass a URL/path that matches an existing local primary checkout.', $repo), array( 'status' => 400 ));
444
+
}
445
+
446
+
$sanitized = $this->sanitize_name($repo);
447
+
if ( '' === $sanitized ) {
448
+
returnnew \WP_Error('invalid_repo', sprintf('Repository argument "%s" did not produce a valid workspace handle.', $repo), array( 'status' => 400 ));
449
+
}
450
+
451
+
return$sanitized;
452
+
}
453
+
454
+
/**
455
+
* Resolve a local path argument to an existing primary handle.
456
+
*
457
+
* @param string $path Local checkout path.
458
+
* @return string|\WP_Error Canonical primary handle or validation error.
returnnew \WP_Error('unsupported_workspace_repo_argument', sprintf('Repository path "%s" does not resolve to an existing local primary checkout. Use a registered primary handle or run workspace clone/adopt first.', $path), array( 'status' => 404 ));
0 commit comments