1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
//! Byte-oriented Git configuration parsing and explicit layered resolution.
//!
//! Configuration has three distinct forms. [`Config`] is an ordered set of decoded occurrences
//! for lookup. [`ConfigInputs`] selects sources and include context for a fresh effective snapshot.
//! [`Document`] retains one file's syntax for editing. An effective snapshot can contain many
//! sources; editing it as if it were one file would lose both provenance and precedence.
//!
//! # Parsing, resolving, and editing configuration
//!
//! - [`Config::parse`] reads one supplied byte source without I/O.
//! - [`Config::from_decoded_sections`] preserves supplied decoded occurrences without parsing.
//! - [`Config::resolve`] reads explicit [`ConfigInputs`], expands includes, and records [`Origin`]
//! for each occurrence. Re-resolve when the caller needs a fresh snapshot.
//! - [`Document`] preserves direct-file syntax for editing; [`ConfigEdit`] holds the file lock
//! through publication. Typed interpretation and policy remain with the caller.
//!
//! [`crate::Repository::open_with_config`] adds repository sources while keeping format bootstrap
//! separate. No operation reads or mutates process-global environment.
//!
//! # Values and precedence
//!
//! Section and variable names fold ASCII case; quoted subsection bytes compare exactly. Scalar
//! lookup uses the last occurrence, while [`Config::values`] preserves repeated occurrences.
//! Repeated variables have consumer-specific semantics: a remote's URLs or refspecs are not
//! necessarily a last-value scalar. [`Entry::origin`] identifies the source and include ancestry
//! after resolution, which helps explain why an effective setting won.
//!
//! Absence, an implicit assignment, and an explicit empty value are different. [`Config::value`]
//! returns `None`, `Some(None)`, and `Some(Some(b""))` respectively. [`Config::boolean`] interprets
//! implicit as true and empty as false. [`Config::string`] treats implicit as absent. Select typed
//! interpretation according to the variable, then apply policy separately.
//!
//! Resolution orders files by scope, preserving caller order within each scope, then applies
//! supplied environment and command overrides. Includes expand in place by default. Repository
//! opening adds local/worktree sources but keeps direct format bootstrap separate: overrides
//! cannot reinterpret stored SHA-1 objects as SHA-256. Supply user and system sources explicitly;
//! [`ConfigInputs::git_default`] selects the ones `git` reads from a caller-supplied environment.
//!
//! # Errors, refresh, and editing
//!
//! [`ConfigError`] identifies invalid syntax and its physical line. [`InvalidValue`] means syntax
//! parsed but the requested type cannot represent the selected value. [`ResolveError`] adds source
//! and include ancestry around I/O, cycles, missing expansion context, and exhausted budgets.
//! Fix the indicated source or context; increase budgets only after considering trusted input and
//! resource cost. Parsing and resolution run no commands and never mutate the process environment.
//!
//! [`ConfigEdit`] locks a selected direct file until commit or abort. Its draft is a [`Document`],
//! not the effective snapshot. Edits preserve unrelated bytes but do not follow includes or update
//! repository handles. After publication, re-resolve or reopen before using the new settings.
//! [`EditError`] distinguishes lock contention, changed source, invalid edits, publication, and
//! cleanup failures. Obtain a fresh lock and reread before retrying; inspect residual owned locks
//! rather than removing another writer's lock. See [`ConfigEdit`] for filesystem assumptions.
//!
//! Parsing allocates with input size. [`ResolveLimits`] bounds source bytes, entries, include
//! depth, and matching work; snapshots are owned and are not automatically refreshed. Files read in
//! one resolution need not come from a single moment under concurrent external writers.
//!
//! # Example
//!
//! Section and key names compare case-insensitively; the last occurrence of a scalar wins, and a
//! key without `=` is an implicit true:
//!
//! ```
//! use girt::Config;
//!
//! let config = Config::parse(b"[core]\n\tbare = false\n[Core]\n\tBare = true\n\tquiet\n")?;
//! assert_eq!(config.value("core", None, "bare"), Some(Some(&b"true"[..])));
//! assert_eq!(config.boolean("core", None, "bare")?, Some(true));
//! assert_eq!(config.value("core", None, "quiet"), Some(None));
//! assert_eq!(config.boolean("core", None, "quiet")?, Some(true));
//! # Ok::<(), Box<dyn std::error::Error>>(())
//! ```
pub use ;
pub use ;
pub use ;
pub use ;
pub use IncludePlacement;
pub
pub use ;
pub use ;
pub use system_file;
pub use ;
pub use parse_boolean;
pub use ;