# git-fast-import
A library for generating [git fast-import](https://git-scm.com/docs/git-fast-import) streams.
This crate provides a simple, type-safe API for creating git commits programmatically
by generating a stream that can be piped to `git fast-import`.
## Example
```rust
use git_fast_import::{GitFastImporter, GITHUB_BOT_AUTHOR};
use std::process::{Command, Stdio};
fn main() {
let mut child = Command::new("git")
.args(["fast-import", "--quiet"])
.stdin(Stdio::piped())
.spawn()
.expect("failed to spawn git fast-import");
let stdin = child.stdin.take().unwrap();
let mut importer = GitFastImporter::new(
stdin,
"main".to_string(),
None,
GITHUB_BOT_AUTHOR.to_string(),
);
let mut commit = importer.start_commit("Initial commit", chrono::Utc::now());
commit.add_file("src/lib.rs", b"// new file").unwrap();
commit.finish().unwrap();
importer.finish().unwrap();
let status = child.wait().expect("failed to wait on git fast-import");
assert!(status.success());
}
```
## License
MIT