Enhance CloneCommand and Syncback functionality

- Added a check in `CloneCommand` to prevent cloning into an existing directory, providing a clearer error message for users.
- Updated the `SyncbackCommand` to support a configurable working directory for resolving relative paths, improving flexibility in project structure.
- Refactored the commit message in the `CloneCommand` to accurately reflect the syncback operation.
- Improved path resolution logic in `SyncbackCommand` to handle both absolute and relative paths more effectively.
This commit is contained in:
Joe 2026-02-06 19:29:37 -06:00
parent 5442c02f67
commit fa5393121e
4 changed files with 40 additions and 12 deletions

View file

@ -113,8 +113,13 @@ pub fn syncback_loop_with_stats(
// TODO: Add a better way to tell if the root of a project is a directory
let skip_pruning = if let Some(path) = &project.tree.path {
let resolved = if path.path().is_absolute() {
path.path().to_path_buf()
} else {
project.folder_location().join(path.path())
};
let middleware =
Middleware::middleware_for_path(vfs, &project.sync_rules, path.path()).unwrap();
Middleware::middleware_for_path(vfs, &project.sync_rules, &resolved).unwrap();
if let Some(middleware) = middleware {
middleware.is_dir()
} else {