Repository navigation
Clone GitHub owner/repo with your gh access, and add an existing checkout instead of refusing it - #1691
Conversation
…ing checkout (#459) The add-project clone field now takes owner/repo shorthand. GitHub sources clone through `gh repo clone` when gh is signed in (private repos work), otherwise plain git over https. A destination that already holds a clone of the same repo is added instead of refused, and the clone/create location defaults next to the selected project. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 343bf6f110
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const slug = slugFromRemoteUrl(url); | ||
| const host = remoteHostOf(url); | ||
| return slug && host ? `${host.host}/${slug}`.toLowerCase() : null; |
There was a problem hiding this comment.
Preserve the full remote path when matching checkouts
When cloning from a host that supports nested namespaces, slugFromRemoteUrl() retains only the final two path segments, so URLs such as https://gitlab.com/team-a/shared/repo and an existing origin at https://gitlab.com/team-b/shared/repo both produce gitlab.com/shared/repo. If the latter occupies the target folder, this equality silently calls addProject() for the wrong checkout instead of rejecting or cloning the requested repository; compare the complete normalized repository path rather than the shortened owner/repo slug.
Useful? React with 👍 / 👎.
Closes the clone half of #459. Typing
owner/repointo Add project → Clone from URL now works, and private GitHub repos clone with the user'sghsign-in instead of failing on the missing git credential. The publish half already shipped as #456 in #1684.Changes
owner/reposhorthand as well as https and ssh URLs.gh repo clonewhengh auth tokensucceeds. Without gh they fall back togit clone, with shorthand expanded tohttps://github.com/owner/repo.git.originis the same host/owner/repo, it's added as the project instead of failing with "Folder is not empty". Any other non-empty folder is still refused.~/.Verification
electron/test/project-clone.test.js: 11/11. New cases cover the gh path, the git fallback for shorthand, and reuse plus host mismatch against a realgit initcheckout.test/addProjectBrowse.test.tsx+addProjectCreate.test.tsx: 10/10, including the shorthand and the next-to-project default.npm run test:electron(with the inheritedCODER_GUARDRAILS_PATHunset): 4961/4961.tsc --noEmitis clean.gh repo cloneagainst GitHub from the running app.Notes for reviewers
./..repo names are rejected.<target>/.gitto exist, so a plain subfolder of some other repo can't match using its parent's origin. ssh host aliases (github-work:) won't match and get the old "not empty" error.ghwith a revoked token fails with gh's own message; there's no retry via git.claude-opus-5-5 via Claude Code
🤖 Generated with Claude Code