@@ -9,7 +9,7 @@ Rustic Git provides a simple, ergonomic interface for common Git operations. It
99## Features
1010
1111- ✅ Repository initialization and opening
12- - ✅ File status checking with detailed parsing
12+ - ✅ File status checking with detailed parsing
1313- ✅ File staging (add files, add all, add updates)
1414- ✅ Commit creation with hash return
1515- ✅ Type-safe error handling
@@ -33,26 +33,26 @@ use rustic_git::{Repository, Result};
3333fn main () -> Result <()> {
3434 // Initialize a new repository
3535 let repo = Repository :: init (" /path/to/repo" , false )? ;
36-
36+
3737 // Or open an existing repository
3838 let repo = Repository :: open (" /path/to/existing/repo" )? ;
39-
39+
4040 // Check repository status
4141 let status = repo . status ()? ;
4242 if ! status . is_clean () {
4343 println! (" Modified files: {:?}" , status . modified_files ());
4444 println! (" Untracked files: {:?}" , status . untracked_files ());
4545 }
46-
46+
4747 // Stage files
4848 repo . add (& [" file1.txt" , " file2.txt" ])? ;
4949 // Or stage all changes
5050 repo . add_all ()? ;
51-
51+
5252 // Create a commit
5353 let hash = repo . commit (" Add new features" )? ;
5454 println! (" Created commit: {}" , hash . short ());
55-
55+
5656 Ok (())
5757}
5858```
@@ -69,7 +69,7 @@ Initialize a new Git repository.
6969// Initialize a regular repository
7070let repo = Repository :: init (" /path/to/repo" , false )? ;
7171
72- // Initialize a bare repository
72+ // Initialize a bare repository
7373let bare_repo = Repository :: init (" /path/to/bare-repo" , true )? ;
7474```
7575
@@ -181,7 +181,7 @@ Create a commit with a custom author.
181181
182182``` rust
183183let hash = repo . commit_with_author (
184- " Add new feature" ,
184+ " Add new feature" ,
185185 " Jane Developer <[email protected] >" 186186)? ;
187187```
@@ -226,36 +226,36 @@ use std::fs;
226226fn main () -> rustic_git :: Result <()> {
227227 // Create a new repository
228228 let repo = Repository :: init (" ./my-project" , false )? ;
229-
229+
230230 // Create some files
231231 fs :: write (" ./my-project/README.md" , " # My Project" )? ;
232232 fs :: write (" ./my-project/src/main.rs" , " fn main() { println!(\ " Hello!\ " ); }" )? ;
233233 fs :: create_dir_all (" ./my-project/src" )? ;
234-
234+
235235 // Check status
236236 let status = repo . status ()? ;
237237 println! (" Found {} untracked files" , status . untracked_files (). len ());
238-
238+
239239 // Stage all files
240240 repo . add_all ()? ;
241-
241+
242242 // Verify staging
243243 let status = repo . status ()? ;
244244 let added_files : Vec <_ > = status . files. iter ()
245245 . filter (| (s , _ )| matches! (s , FileStatus :: Added ))
246246 . map (| (_ , f )| f )
247247 . collect ();
248248 println! (" Staged files: {:?}" , added_files );
249-
249+
250250 // Create initial commit
251251 let hash = repo . commit (" Initial commit with project structure" )? ;
252252 println! (" Created commit: {}" , hash . short ());
253-
253+
254254 // Verify clean state
255255 let status = repo . status ()? ;
256256 assert! (status . is_clean ());
257257 println! (" Repository is now clean!" );
258-
258+
259259 Ok (())
260260}
261261```
@@ -273,7 +273,7 @@ cargo run --example basic_usage
273273# Repository lifecycle operations
274274cargo run --example repository_operations
275275
276- # Status checking and file state filtering
276+ # Status checking and file state filtering
277277cargo run --example status_checking
278278
279279# Staging operations (add, add_all, add_update)
@@ -309,13 +309,58 @@ All tests create temporary repositories in `/tmp/` and clean up after themselves
309309
310310## Contributing
311311
312- This library follows these design principles:
312+ We welcome contributions! Please follow these guidelines when contributing to rustic-git:
313+
314+ ### Code Standards
315+
316+ - ** Rust Edition** : Use Rust edition 2024
317+ - ** Style Guide** : Follow the Rust style guide for naming conventions and formatting
318+ - ** Code Quality** : Implement best practices for code organization and maintainability
319+ - ** No Emojis** : Do not use emoji in code or commit messages
320+
321+ ### Design Principles
322+
323+ - ** Repository-centric API** : Static lifecycle methods (` init ` , ` open ` ) return ` Repository ` instances, instance methods for git operations
324+ - ** Module-based organization** : Separate files for repository.rs, error.rs, with lib.rs for re-exports only
325+ - ** Co-located unit tests** : Tests within each module (` #[cfg(test)] mod tests ` ) rather than separate test files
326+ - ** Early validation** : Always call ` Repository::ensure_git() ` before git operations to validate git availability
327+ - ** Path handling** : Use ` PathBuf ` for internal storage, ` &Path ` for method parameters and returns, ` impl AsRef<Path> ` for flexibility
328+ - ** Error handling** : Custom ` GitError ` enum with ` From<io::Error> ` trait for ergonomic error propagation
329+ - ** Command execution** : Use ` std::process::Command ` with proper error handling and stderr capture
330+
331+ ### Development Workflow
332+
333+ Before submitting a pull request, ensure your code passes all checks:
334+
335+ ``` bash
336+ # Format code
337+ cargo fmt
338+
339+ # Build project
340+ cargo build
341+
342+ # Run all tests
343+ cargo test
344+
345+ # Run linting (no warnings allowed)
346+ cargo clippy --all-targets --all-features -- -D warnings
347+
348+ # Verify all examples work
349+ cargo run --example basic_usage
350+ cargo run --example repository_operations
351+ cargo run --example status_checking
352+ cargo run --example staging_operations
353+ cargo run --example commit_workflows
354+ cargo run --example error_handling
355+ ```
356+
357+ ### Pull Request Guidelines
313358
314- - ** Repository-centric API ** : Static lifecycle methods ( ` init ` , ` open ` ) return ` Repository ` instances
315- - ** Type safety ** : Strong typing with custom error types and structured return values
316- - ** Ergonomic design ** : Clean, intuitive API that follows Rust conventions
317- - ** Comprehensive testing ** : All functionality thoroughly tested
318- - ** Modular organization ** : Commands organized in separate modules
359+ 1 . Ensure all tests pass and examples run successfully
360+ 2 . Follow conventional commit format: ` type(scope): description `
361+ 3 . Use types like ` feat ` , ` fix ` , ` docs ` , ` style ` , ` refactor ` , ` test ` , ` chore `
362+ 4 . Keep commit messages concise and in present tense
363+ 5 . Make sure your changes align with the project's design principles
319364
320365## License
321366
@@ -325,7 +370,7 @@ MIT License - see LICENSE file for details.
325370
326371Future planned features:
327372- [ ] Commit history and log operations
328- - [ ] Diff operations
373+ - [ ] Diff operations
329374- [ ] Branch operations
330375- [ ] Remote operations (clone, push, pull)
331376- [ ] Merge and rebase operations
@@ -334,4 +379,4 @@ Future planned features:
334379
335380## Version
336381
337- Current version: 0.1.0 - Basic git workflow (init, status, add, commit)
382+ Current version: 0.1.0 - Basic git workflow (init, status, add, commit)
0 commit comments