Conversation
Add comprehensive repository configuration management with RepoConfig struct providing type-safe git configuration operations. Includes convenience methods for user setup and generic configuration handling.
There was a problem hiding this comment.
Pull Request Overview
This PR adds comprehensive repository configuration management to the rustic-git library by introducing a RepoConfig struct that provides type-safe git configuration operations. The implementation includes convenience methods for user setup and generic configuration handling.
Key changes:
- Added
RepoConfigstruct with methods for setting/getting git configuration values - Integrated configuration API with existing test code to replace manual git config calls
- Added comprehensive documentation and examples for the new configuration functionality
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/commands/config.rs | New module implementing RepoConfig struct with configuration management methods |
| src/repository.rs | Added config() method to Repository for accessing configuration API |
| src/lib.rs | Exported RepoConfig in public API |
| src/commands/mod.rs | Added config module and RepoConfig export |
| src/commands/log.rs | Updated test to use new config API instead of manual git calls |
| src/commands/commit.rs | Refactored tests to use RepoConfig API for user configuration |
| src/commands/branch.rs | Updated test to use new config API for user setup |
| examples/config_operations.rs | New comprehensive example demonstrating configuration operations |
| README.md | Updated documentation with configuration API details and examples |
| CLAUDE.md | Updated development notes with new configuration functionality |
Comments suppressed due to low confidence (1)
src/commands/config.rs:1
- Hardcoded
/tmp/paths in documentation examples may fail on Windows systems. Consider usingstd::env::temp_dir()or a more portable approach in production code examples.
use crate::utils::git;
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
|
||
| #[test] | ||
| fn test_config_set_and_get_user() { | ||
| let test_path = "/tmp/test_config_user"; |
There was a problem hiding this comment.
Hardcoded /tmp/ paths in tests may fail on Windows systems. Consider using std::env::temp_dir() for cross-platform compatibility.
|
|
||
| #[test] | ||
| fn test_config_set_and_get_generic() { | ||
| let test_path = "/tmp/test_config_generic"; |
There was a problem hiding this comment.
Hardcoded /tmp/ paths in tests may fail on Windows systems. Consider using std::env::temp_dir() for cross-platform compatibility.
|
|
||
| #[test] | ||
| fn test_config_unset() { | ||
| let test_path = "/tmp/test_config_unset"; |
There was a problem hiding this comment.
Hardcoded /tmp/ paths in tests may fail on Windows systems. Consider using std::env::temp_dir() for cross-platform compatibility.
|
|
||
| #[test] | ||
| fn test_config_get_nonexistent_key() { | ||
| let test_path = "/tmp/test_config_nonexistent"; |
There was a problem hiding this comment.
Hardcoded /tmp/ paths in tests may fail on Windows systems. Consider using std::env::temp_dir() for cross-platform compatibility.
|
|
||
| #[test] | ||
| fn test_config_integration_with_commit() { | ||
| let test_path = "/tmp/test_config_commit_integration"; |
There was a problem hiding this comment.
Hardcoded /tmp/ paths in tests may fail on Windows systems. Consider using std::env::temp_dir() for cross-platform compatibility.
| println!("Rustic Git - Repository Configuration Operations Example\n"); | ||
|
|
||
| // Use a temporary directory for this example | ||
| let repo_path = "/tmp/rustic_git_config_example"; |
There was a problem hiding this comment.
Hardcoded /tmp/ path may fail on Windows systems. Consider using std::env::temp_dir() for cross-platform compatibility.
Add comprehensive repository configuration management with RepoConfig struct providing type-safe git configuration operations. Includes convenience methods for user setup and generic configuration handling.