#git #config #git-config #gitoxide


A git-config file parser and editor from the gitoxide project

11 releases

0.1.9 Nov 29, 2021
0.1.8 Nov 16, 2021
0.1.7 Oct 15, 2021
0.1.6 Sep 7, 2021
0.0.0 Oct 5, 2020

#117 in Parser implementations

Download history 97/week @ 2021-10-01 133/week @ 2021-10-08 389/week @ 2021-10-15 308/week @ 2021-10-22 467/week @ 2021-10-29 392/week @ 2021-11-05 369/week @ 2021-11-12 318/week @ 2021-11-19 517/week @ 2021-11-26 454/week @ 2021-12-03 560/week @ 2021-12-10 160/week @ 2021-12-17 206/week @ 2021-12-24 171/week @ 2021-12-31 251/week @ 2022-01-07 353/week @ 2022-01-14

999 downloads per month
Used in 6 crates (3 directly)




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.


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#"
  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!");


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.


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.


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.


~19K SLoC