Repository navigation
feat(web): add an existing folder instead of cloning onto another machine - #1
Closed
marcelruhf wants to merge 4 commits into
Closed
marcelruhf wants to merge 4 commits into
marcelruhf wants to merge 4 commits into
Conversation
…nother machine Adding a project to another machine failed with "Destination path already exists and is not empty" when that machine already had a checkout at the destination, leaving the user at a dead end. The server now tags that clone failure with reason "destination-not-empty". The Add to another machine dialog reads it and offers "Add existing folder", which adds the folder on that machine as the project without copying any files. Changing the folder or machine returns the dialog to cloning. Model and harness: Claude Opus 5.5 in Amp. Amp-Thread-ID: https://ampcode.com/threads/T-01a1ff98-adfc-71e2-831e-72f58c684e8a Co-authored-by: Marcel Ruhf <marcel@ruhf.eu>
Adding the existing folder failed with "Failed to mutate project." when a project on that machine already owned it, for example one grouped separately or archived. The clone refusal now carries the server's resolved folder path (occupiedDestination) instead of a bare reason, since the client cannot expand "~" for another machine. The dialog looks for a project at that path on the target and opens it, unarchiving it first when needed, and only creates a project when none owns the folder. Model and harness: Claude Opus 5.5 in Amp. Amp-Thread-ID: https://ampcode.com/threads/T-01a1ff98-adfc-71e2-831e-72f58c684e8a Co-authored-by: Marcel Ruhf <marcel@ruhf.eu>
…r flow Renames the dialog's refused-folder state, its resolved path, and the test mocks so they read without explanation, and deletes a comment whose claims were false (the folder need not be a checkout, nor already owned by a project). The occupiedDestination contract doc keeps only what the field is. Model and harness: Claude Opus 5.5 in Amp. Amp-Thread-ID: https://ampcode.com/threads/T-01a1ff98-adfc-71e2-831e-72f58c684e8a Co-authored-by: Marcel Ruhf <marcel@ruhf.eu>
The create, unarchive, or open decision moves into a pure AddProjectToMachineDialog.logic.ts with a table test, reusing findExistingAddProject, and the browser test keeps only the offer and its reset. Project create and unarchive go through useOrchestrationCommand like the other add-project entry points, so a connection without the operate scope fails before the request. While the folder is offered, the dialog's description says so instead of describing a clone, and the button reads "Adding…" while it works. Model and harness: Claude Opus 5.5 in Amp. Amp-Thread-ID: https://ampcode.com/threads/T-01a1ff98-adfc-71e2-831e-72f58c684e8a Co-authored-by: Marcel Ruhf <marcel@ruhf.eu>
Owner
Author
|
Closing in favour of upstream pingdotgg#31106, which covers the same case (an existing folder at the clone destination) more completely, including Combine/Replace and mobile. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
@marcelruhf sees this as a boundary case between a feature and a bug fix, and decided to give it a shot anyway. No hard feelings if maintainers decide to close it.
Why
Adding a project to another machine failed with "Source control repository operation cloneRepository failed for unknown: Destination path already exists and is not empty." whenever that machine already had a checkout at the destination. The user had nowhere to go from there, even though the folder they wanted was already on that machine.
What changed
SourceControlRepositoryErrornow carriesoccupiedDestination, the folder resolved on that machine (~expanded). Clients key off this field instead of the error text. They need the resolved path because they can't expand~for another machine..envand similar files stay as they are. The copy list and the SSH/HTTPS picker are hidden in this state. Editing the folder or switching machines returns the dialog to cloning. Create and unarchive go throughuseOrchestrationCommand, like the other add-project entry points.The command palette's clone, the prompt-link clone, and the mobile Add Project clone receive the same typed error but don't offer this yet. They sit inside Add Project flows rather than this dialog.
Screenshots
Before (
main) and after, at the moment a clone is refused because~/code/t3codealready exists on the Laptop. Both are Vitest browser renders of the dialog with the app stylesheet. Screenshots to be attached by the author below.Verification
SourceControlRepositoryService.test.ts: a non-empty destination fails withoccupiedDestinationset to the resolved path. Fails with the server change reverted.AddProjectToMachineDialog.logic.test.ts: the create, unarchive, or open decision for a taken folder (no owner, active owner, archived owner). Fails if an archived owner is opened without unarchiving.AddProjectToMachineDialog.browser.test.tsx: a refused clone offers the folder, and editing the path returns to cloning..envuntouched; (2) a folder already owned by a separately grouped Laptop project, which opened that project and created no duplicate; (3) the same folder with that project archived, which unarchived and opened it.vp run check:changedpasses (format, lint, knip, typecheck for 43 packages, tests and React Compiler checks next to the changes).vp run i18n:checkpasses.Model and harness: Claude Opus 5.5 in Amp (thread).
Summary by cubic
Moving a project to another machine now offers to add an existing folder when the destination already holds files. Previously the clone failed with "Destination path already exists and is not empty", leaving no way forward.
The server now carries the resolved destination path on that failure, and the "Add to another machine" dialog switches its main button to Add existing folder. Confirming creates the project at that path without copying files, so the checkout's own
.envand similar files stay as they are. If a project on that machine already owns the folder, the dialog opens that project, unarchiving it first when needed. Editing the folder or switching machines returns the dialog to cloning. The command palette's clone and the mobile clone flow get the same failure but don't offer this yet.Written for commit 0d82b12. Summary will update on new commits.