Skip to content

Conversation

@botovq
Copy link
Member

@botovq botovq commented Dec 6, 2025

I was in precisely the situation described in the second commit where I wanted to add a workspace at the root of a file system and was first confused by the error message and then why it refused to use the empty directory. This makes the behavior and errors consistent with jj git clone.

Unsure if the move of is_empty_dir() is to the right spot, but it seemed to fit well enough next to remove_dir_contents().

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have updated the config schema (cli/src/config-schema.json)
  • I have added/updated tests to cover my changes

@botovq botovq requested a review from a team as a code owner December 6, 2025 22:36
Copy link
Contributor

@yuja yuja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

@botovq botovq force-pushed the push-nmnqnpsyqtoq branch from cb5280b to 58313e7 Compare December 8, 2025 13:18
This moves the is_empty_dir() helper from the clone subcommand to the
library  and changes its return value to Result<bool, PathError>, so
it can be used from elsewhere. The next commit will make use of it in
commands/workspace/add.rs.
Cloning into an existing empty directory works. There is no reason why
'jj workspace add' should fail. After all, the directory is empty.

For example, if the target directory is the root of a file system,
it is impossible to remove directory to let 'jj workspace add' create
it. Reword the error message to match the one for jj git clone.
@botovq botovq force-pushed the push-nmnqnpsyqtoq branch from 58313e7 to 37880cc Compare December 8, 2025 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants