This has been merged as part of gitoxide. https://github.com/Byron/gitoxide/
This repository has been archived on 2021-03-14. You can view files and clone it, but cannot push or open issues or pull requests.
Find a file
2021-03-08 17:15:56 -05:00
.vscode Use traits instead of shadowing from_str 2021-02-26 21:32:37 -05:00
benches benchmarks 2021-03-01 18:33:07 -05:00
fuzz Don't immediately drop fuzzer values 2021-02-24 17:55:58 -05:00
src remove offset newtype 2021-03-08 17:15:56 -05:00
tests/integration_tests section stuct 2021-03-06 21:25:21 -05:00
.gitignore make serde optional, clippy lints 2021-02-24 12:11:18 -05:00
Cargo.toml remove serde code for now 2021-03-03 18:14:57 -05:00
LICENSE-APACHE implement case insensitivity for names 2021-03-06 01:23:23 -05:00
LICENSE-MIT implement case insensitivity for names 2021-03-06 01:23:23 -05:00
README.md fix example 2021-03-06 11:46:04 -05:00

git-config

git-config is a library for interacting with git-config files.

This crate intents to be a performant Rust implementation for reading and writing git-config files. It exposes tiers of abstractions, from simple config value wrappers to a high level reader and writer.

The highlight of this crate is the zero-copy parser. We employ techniques to avoid copying where necessary, and reads that do not need normalization are guaranteed to be zero-copy. Higher level abstractions maintain this guarantee, and utilizes acceleration structures for increased performance.

Currently, this is not a binary. While we do intent to have a drop-in replacement for the git config sub-command, we're currently missing system-level abstractions to do so.

Examples

Reading and writing to a config:

use git_config::file::GitConfig;
use git_config::values::Boolean;
use std::fs::read_to_string;

let input = r#"
[core]
  some-bool = true

[other "internal"]
  hello = world
"#;
let mut config = GitConfig::from(input)?;
let boolean = config.get_config::<Boolean>("core", None, "some-bool");
config.set_value("other", Some("internal"), "hello", "clippy!");

Contributing

Contributions are always welcome!

Code quality

This repository enables pedantic, cargo, and nursery clippy lints. Make sure to run cargo clean && cargo clippy (the clean stage is very important!) to ensure your code is linted.

Testing

Since this is a performance oriented crate, in addition to well tested code via cargo test, we also perform benchmarks to measure notable gains or losses in performance. We use criterion so benches can be run via cargo bench after installing it via cargo install cargo-criterion.

Changes to parser.rs may include a request to fuzz to ensure that it cannot panic on inputs. This can be done by executing cargo fuzz parser after installing the fuzz sub-command via cargo install cargo-fuzz.

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in git-config by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.