feat(workspace): add standalone workspace sync - #19
Merged
Conversation
…ing-path reporting Add a copy helper that, unlike copy_setup_files, records patterns that matched no source path instead of silently skipping them, and supports a no-write dry run. Directories are copied recursively, parent directories are created as needed, and matches are deduped in pattern order. This is the primitive backing `gx workspace sync`.
Add the CLI surface for syncing files between workspaces: an optional target, optional repo-relative paths, a --from source override, and --dry-run. Drop the `sync` alias from `workspace update` so it no longer collides with the new subcommand.
Add run_sync plus a source/target resolver that accepts workspace names, branch names, fuzzy queries, or absolute paths. Target defaults to the current workspace, source to the main worktree, and paths to the configured copy_files (global config plus the repo profile, deduped). Syncing a workspace to itself is refused. All human-readable output goes to stderr since this command does not participate in shell navigation.
# Conflicts: # README.md # src/args.rs # src/commands/workspace.rs
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.
What
Adds
gx workspace sync, a manual copy tool for moving setup files (e.g..env) between specific workspaces. It complementsgx workspace setup, which applies the configured policy to the current workspace;synclets you copy arbitrary paths between arbitrary workspaces.Defaults
copy_files(global config plus the repo profile, deduped) — the same set workspace creation/setup uses.Behavior
gx workspace go.--dry-runreports what would be copied without writing anything.Why
Setup files sometimes need to be copied after workspace creation, or pulled from a non-main workspace. Previously only the configured
setupflow was available, with no way to sync arbitrary paths between specific workspaces.How it was built
src/repo_setup.rs. A newsync_pathsprimitive adds dry-run support and reports patterns that matched no source path (rather than silently skipping them), returning aCopyOutcome { copied, missing }.paths_equalhelpers insrc/commands/workspace.rs; a small resolver maps a query/branch/absolute path to a worktree root.syncalias onworkspace updateso it no longer collides with the new subcommand.Testing
cargo build— passes, no warnings.cargo clippy— clean.cargo test— 141 passed, 0 failed.New tests cover:
paths_equal).sync_pathscopies files and directories, creates parent dirs, dry-run writes nothing, missing paths are summarized (non-fatal), and overlapping patterns are deduped.