Tags: timabell/gitopolis
Tags
refactor: Convert move command to use proper nested subcommands (#220) The `move` command now uses CLAP's nested subcommand structure instead of treating entity_type as a positional argument. This improves: - CLI structure to follow standard conventions - Help text organization and clarity - Validation (CLAP validates subcommand names) - Future extensibility for other entity types - Code maintainability The user-facing command remains identical: `gitopolis move repo OLD NEW` but internally 'repo' is now a proper subcommand rather than a string argument. Prompts: - can we do anything about [`move repo` isn't a proper sub-command · Issue #220 · timabell/gitopolis](#220) with CLAP? - yes Fixes #220 Co-Authored-By: Claude <noreply@anthropic.com>
feat: Handle clone failures gracefully
When cloning multiple repositories and one fails (e.g., due to invalid URL
or missing remote), gitopolis now:
- Continues cloning other repositories
- Tracks the number of failures
- Prints warnings for each failed clone
- Exits with status code 1 if any clones failed
- Displays total count of failed clones
This matches the behavior of the exec command when commands fail.
Changes:
- Update Git trait: clone() now returns Result<(), GitopolisError>
- Update GitImpl::clone: Check command status and return error on failure
- Update Gitopolis::clone: Track failures, print warnings, exit with code 1
- Update Gitopolis::clone_and_add: Propagate clone errors
- Add end-to-end test: clone_with_failures_exits_with_error_count
Prompts:
- if clone fails and there is a second remote it currently falls over, it should behave like test exec_invalid_command() with a count of number of failed clones and a non-zero exit. TDD this.
Co-Authored-By: Claude <noreply@anthropic.com>
Previously failed with:
Before this patch if there were two remotes and the first one failed
then the attempt to add the second would fail with:
thread 'main' panicked at src\git.rs:64:14:
Error running git remote add: Os { code: 267, kind: NotADirectory,
message: "The directory name is invalid." }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Handle Windows path separators in URL extraction for clone command The extract_repo_name_from_url function now splits by backslash (\) in addition to forward slash (/) and colon (:) to properly handle Windows paths. This fixes Windows CI test failures where absolute Windows paths were not being parsed correctly, causing the full path to be used as the repository name instead of just the final component. Added test cases for Windows path formats. Prompts: - windows ci failed on [feat: Add move command to relocate repositories · 4b86d54](4b86d54) - https://github.com/rustworkshop/gitopolis/actions/runs/18580182075/job/52973341280 - keep the fix if you think it's good Co-Authored-By: Claude <noreply@anthropic.com>
fix: Continue exec when repo folder missing, report skipped repos, ex… …it non-zero Previously, the exec command would return from the entire function when encountering a missing repository folder, stopping all remaining repos from being processed. This change makes exec continue through all repositories, tracking both errors and skipped repos, and reporting them at the end. Changes: - Replace early return with continue when repo folder is missing - Track skipped_count separately from error_count - Format skip message appropriately for both oneline and normal modes - Report both error and skip counts at the end - Exit with non-zero status when repos are skipped or commands fail - Add test coverage for missing repos in both normal and oneline modes Test Coverage: 1. exec_missing: Normal mode, only missing repos ✓ 2. exec_non_zero: Normal mode, only failed commands ✓ 3. exec_oneline_missing: Oneline mode, only missing repos ✓ (NEW) 4. exec_oneline_non_zero: Oneline mode, only failed commands ✓ Each test verifies: - Missing repos are skipped with appropriate message - Skip count is reported in stderr - Exit code is 1 when repos are skipped or commands fail - Output format is correct for both normal and oneline modes Prompts: - Exec should not stop when a folder missing, it should note it's skipped, and like the other commands put a final "xxx failed/skipped" at the end and exit non-zero - is that enough test coverage? looks to me like it should have coverage for failed command, skipped missing (both in one test is fine), oneline and multiline (one test each) - four combinations of assertions total - exec_mixed_failure_and_missing is a lie - never mind, let's just have split up tests, one of each of the four failure scenarios - I don't like it having looked at the diff - split it up to one test per scenario - amend the prev commit - look at the last commit message and merge in the additional context Co-Authored-By: Claude <noreply@anthropic.com>
PreviousNext