Commit 3e47fc9
Address code review comments from PR #1518
This commit addresses the unresolved review comments from the merged PR
that added the josh CLI tool:
## Error Handling Improvements
- Add anyhow and thiserror to workspace dependencies
- Replace Box<dyn std::error::Error> with anyhow::Result throughout josh-cli
- Use anyhow::Context for better error messages with context
## josh-core/src/changes.rs Improvements
- Use into_iter() instead of iter() where changes vec is consumed
- Replace manual indexing with .windows(2) for cleaner iteration
- Use iterator chaining with base_tree for tree collection
- Use HashSet::insert() which returns false for duplicates
- Improve variable naming: old -> base_oid, v -> push_refs
- Change ref_with_options parameter from String to &str for consistency
- Replace if let with match for better pattern matching
- Use filter_map instead of filter + map
## josh-cli/src/bin/josh.rs Improvements
- Remove all std::env::set_current_dir() calls (hacky global state)
- Create internal helper functions that accept repo_path parameter:
- handle_fetch_internal(args, repo_path)
- handle_remote_add_internal(args, repo_path)
- handle_filter_internal(args, repo_path, print_messages)
- apply_josh_filtering(repo_path, filter, remote_name)
- Remove commented out code
- Update all error handling to use anyhow::Context
- Fix build_to_push call to pass &remote_ref instead of remote_ref
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Vlad Ivanov <vlad-ivanov-name@users.noreply.github.com>1 parent 50481f5 commit 3e47fc9
File tree
6 files changed
+327
-427
lines changed- josh-cli
- src/bin
- josh-core/src
- josh-proxy/src
6 files changed
+327
-427
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
0 commit comments