Problem
issue:setup-remote fails for projects that migrated to GitLab work items (e.g. Canvas). Work-item ids are not Drupal.org issue nodes, so the node lookup returns no project machine name and the command builds a remote named -<id>, which git remote add rejects as an option:
$ drupalorg issue:setup-remote 3591806
In SetupIssueRemoteAction.php line 38:
Failed to add remote -3591806: The command "'git' 'remote' 'add' '-3591806'
'git@git.drupal.org:issue/-3591806.git'" failed.
Error Output:
================
error: unknown switch `3'
usage: git remote add [<options>] <name> <url>
Work item 3591806 is a Canvas issue with an existing fork at git@git.drupal.org:issue/canvas-3591806.git and an open MR (project/canvas!1352). The fork is fine; only the project name resolution fails.
Root cause
GetIssueForkAction resolves the project exclusively through the Drupal.org node API:
if ($projectMachineName === null) {
$issue = $this->client->getNode($nid);
$projectMachineName = $issue->fieldProjectMachineName;
}
$remoteName = $projectMachineName . '-' . $nid;
$gitLabProjectPath = 'issue/' . $remoteName;
For a work-item id the node either does not exist or is an unrelated node that happens to share the id (3591806 resolves to a restrict_login_ip release node with no project field). $projectMachineName ends up empty, producing -3591806 and issue/-3591806.git.
Proposed fix
Fall back to GitLab when the node lookup yields no project machine name:
- Resolve the work item via the GitLab API (
/groups/project/work_items or the issue fork naming convention) to get the project machine name, or
- Derive it from the current repository's
origin remote (git@git.drupal.org:project/canvas.git → canvas), since the command already runs inside the project checkout.
Either way, guard against an empty machine name and fail with an explicit "could not resolve project for id" error instead of passing a --prefixed name to git.
Related: #337 handled work items in the skill docs; this is the same migration gap in the command itself.
Workaround
$ git remote add canvas-3591806 git@git.drupal.org:issue/canvas-3591806.git
$ git fetch canvas-3591806
Problem
issue:setup-remotefails for projects that migrated to GitLab work items (e.g. Canvas). Work-item ids are not Drupal.org issue nodes, so the node lookup returns no project machine name and the command builds a remote named-<id>, whichgit remote addrejects as an option:Work item 3591806 is a Canvas issue with an existing fork at
git@git.drupal.org:issue/canvas-3591806.gitand an open MR (project/canvas!1352). The fork is fine; only the project name resolution fails.Root cause
GetIssueForkActionresolves the project exclusively through the Drupal.org node API:For a work-item id the node either does not exist or is an unrelated node that happens to share the id (3591806 resolves to a
restrict_login_iprelease node with no project field).$projectMachineNameends up empty, producing-3591806andissue/-3591806.git.Proposed fix
Fall back to GitLab when the node lookup yields no project machine name:
/groups/project/work_itemsor the issue fork naming convention) to get the project machine name, ororiginremote (git@git.drupal.org:project/canvas.git→canvas), since the command already runs inside the project checkout.Either way, guard against an empty machine name and fail with an explicit "could not resolve project for id" error instead of passing a
--prefixed name to git.Related: #337 handled work items in the skill docs; this is the same migration gap in the command itself.
Workaround