-
Notifications
You must be signed in to change notification settings - Fork 752
Closed
Description
The logic added in #7392 to restrict use of git colocation status|enable|disable to the main workspace seems not to work as intended:
$ mkdir foo
$ jj git init foo
Initialized repo in "foo"
Hint: Running `git clean -xdf` will remove `.jj/`!
$ jj -R foo workspace add bar
Created workspace in "bar"
Warning: Workspace created inside current directory. If this was unintentional, delete the "bar" directory and run `jj workspace forget bar` to remove it.
Working copy (@) now at: qyrmnsxx e2d0d56c (empty) (no description set)
Parent commit (@-) : zzzzzzzz 00000000 (empty) (no description set)
$ jj -R bar git colocation status
Repository is currently not colocated with Git.
Hint: To enable colocation, run: `jj git colocation enable`
$ jj -R bar git colocation enable
Error: Failed to move Git repository from .jj/repo/store/git to repository root directory.
Caused by: No such file or directory (os error 2)I haven't tested it, but I think the problem is that the repo_path points at the repo_path of the main workspace, so will always be a directory and thus repo_supports_git_colocation_commands() succeeds:
Lines 548 to 560 in 3c98f9a
| if repo_dir.is_file() { | |
| let buf = fs::read(&repo_dir).context(&repo_dir)?; | |
| let repo_path = | |
| file_util::path_from_bytes(&buf).map_err(WorkspaceLoadError::DecodeRepoPath)?; | |
| repo_dir = dunce::canonicalize(jj_dir.join(repo_path)).context(repo_path)?; | |
| if !repo_dir.is_dir() { | |
| return Err(WorkspaceLoadError::RepoDoesNotExist(repo_dir)); | |
| } | |
| } | |
| let working_copy_state_path = jj_dir.join("working_copy"); | |
| Ok(Self { | |
| workspace_root: workspace_root.to_owned(), | |
| repo_path: repo_dir, |
Metadata
Metadata
Assignees
Labels
No labels