-
Notifications
You must be signed in to change notification settings - Fork 352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
workspace: warn if destination doesn't contain path separator #4128
Conversation
I never saw the original ticket. I actually do use this feature. I keep a This empty directory is a convenient "workspace root" to place your various cd $(jj workspace root) # go to the root of the default workspace
jj sparse set --clear --add work # only leave work/ in in the working copy This removes all files except the top-level jj workspace add work/new-feature # create first new workspace
jj workspace add work/fix-bug-123 # create second new workspace Now, your working copy is empty, but the the directory This kind of workflow is useful for scenarios where you want to e.g. execute In a sense, this turns the Git model for change management on its head, since Run |
That's an interesting workflow! I hadn't considered that, but that does seem useful. Perhaps it would be better to just require there be a path separator somewhere in the path or something like that? That way you couldn't accidentally create a workspace inside another one with |
Actually, it looks more like Bazaar(Breezy) in the default mode, where the repo is shared. |
cfbac96
to
cf3e74e
Compare
I updated the PR to just produce an error if there's no path separators in the destination, since this seems like a simple way to avoid spurious errors. So it would look like this:
|
cf3e74e
to
dc0bcff
Compare
It's inconsistent that |
I personally think it's an easy mistake to make, since I do agree that only requiring a path separator for one command seems inconsistent though, so I'll look into making it a warning instead. I think it's good to have a warning at least, because having a workspace inside of another workspace can be confusing, so a warning explaining what happened would be useful. |
Good point. Do you think we should change the syntax for creating a workspace to |
Another option could be something like this: # Create workspace at <path> with basename as name
jj workspace add --at <path>
# Create workspace <name> at <path>
jj workspace add <name> --at <path>
# Create workspace <name> at <path>/<name>
jj workspace add <name> --in <path>
# Create workspace <name> at ../<name>
jj workspace add <name> I don't mind the way it currently works though. |
I don't think |
dc0bcff
to
1680bc0
Compare
Ok, I updated it to just show a warning with instructions on how to remove the workspace if it was unintentional. Do you think it's clear enough? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A warning should be good enough as it also preserves @thoughtpolice workflow.
This test case was creating "workspace1" as a sub-directory of the default workspace, which seems like a mistake.
Users may try to run `jj workspace add <name>` without specifying a path, which results in the workspace being created in the current directory. This can be confusing, since the workspace contents will also be snapshotted in the original workspace if it is not sparse. Adding a warning should reduce confusion in this case.
1680bc0
to
71114c4
Compare
Users may try to run
jj workspace add <name>
without specifying a path, which results in the workspace being created in the current directory. This can be confusing, since the workspace contents will also be snapshotted in the original workspace if it is not sparse. Adding a warning should reduce confusion in this case.Resolves #865.
Checklist
If applicable:
CHANGELOG.md