-
Notifications
You must be signed in to change notification settings - Fork 0
feat(config): add repository configuration management API #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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"; |
Copilot
AI
Sep 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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"; |
Copilot
AI
Sep 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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"; |
Copilot
AI
Sep 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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"; |
Copilot
AI
Sep 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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"; |
Copilot
AI
Sep 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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"; |
Copilot
AI
Sep 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.