All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
A maintenance release without user-facing changes.
Clippy helped 1 time to make code idiomatic.
add more test cases to pin behaviour around string and path handling. This is important to know how to consistently handle empty strings - should they not be present? Or should they be flagged as error?
The answer here is that the caller has to deal with it, as we report these values if they are present which only requires an equals sign.
7891fb1
)8a60d5b
)9c528dc
)db0c401
)log
dependency in favor of gix-trace
dyn
trait where possible. This reduces compile time due to avoiding duplication.Clippy helped 1 time to make code idiomatic.
8bd0456
)375db06
)6135a5e
)gix
usage for faster compile time (9d33e2f
)log
dependency in favor of gix-trace
(2b8d09f
)dyn
ification (f658fcc
)dyn
trait where possible. (072ee32
)5044c3b
)363ee77
)nom
to winnow
in remaining uses in gix-object
, gix-ref
, and gix-actor
for ~20% more performance. It's likely that over time, these parsers will get even faster due to improvements to winnow
. Thanks, Ed Page, for single-handedly performing this transition.fix incorrect s/git-config/gix-config/ 3a861c8f049f6502d3bcbdac752659aa1aeda46a just blindly replaced any occurence of “git-config” or “git_config” with “gix-config”/“gix_config”.
There is no such thing as a gix-config file. gix-config is a git-config file parser.
regression that could cause non-linear parsing behaviour.
30b2761
)f23ea88
)8f3f358
)73c685a
)0d258f4
)nom
to winnow
in remaining uses in gix-object
, gix-ref
, and gix-actor
for ~20% more performance. (ef54aab
)winnow
to latest patch release (8c41848
)7735047
)c51c8da
)66dadf8
)a743c5d
)0f9af3f
)5366f79
)e208362
)3f8c91f
)ee75de1
)510192e
)File::push_section()
is now infallible. Previously it used a Result
even though it couldn't fail anywhere.4604f83
)gix-submodule
(f3c4311
)b629f8a
)File::push_section()
is now infallible. (d091c78
)6b4a303
)ef8ccd9
)The parsing switches from nom
to winnow
, which eases maintenance and improves performances.
231ac1c
)db63815
)e4d2890
)daf3389
)224121b
)1a1e2f5
)beac408
)63552ee
)8db009c
)fe997c8
)8581d25
)9e6ba0f
)b790948
)5fc1096
)083efbc
)5f2b68e
)0fe3854
)d2e06c8
)edb4e04
)bdcd379
)42ae766
)b0287a8
)a639994
)cfc642a
)18bee03
)6ac1b37
)5b3ae94
)3d9ae21
)A maintenance release without user-facing changes.
A maintenance release without user-facing changes.
Clippy helped 1 time to make code idiomatic.
68ae3ff
)c70e54f
)e4dded0
)3ef32af
)A maintenance release without user-facing changes.
69c6a36
)c143cf4
)gix-path
across all crates (73c1292
)A maintenance release without user-facing changes.
27e8c18
)00f96fb
)285ce12
)clippy::redundant-closure-for-method-calls
lintea9f942
)18b0a37
)aa16c8c
)4f635fc
)fe59956
)clippy::redundant-closure-for-method-calls
lint (bcad5c2
)9a9fa96
)8f15cec
)420553a
)2578e57
)dbf8aa1
)4795fcf
)3ef5c90
)279dc09
)dbc6cbb
)13e01f5
)A maintenance release without user-facing changes.
7ebc9f7
)0135158
)43ebaf2
)home
in env::home_dir()
gix-path
for obtaining some shared directories as base for path generation. This will make system wide configuration available on windows at least when using the migw builds. Rename serde1
cargo feature to serde
and use the weak-deps cargo capability. With it it's possible to not automatically declare all optional dependencies externally visible features, and thus re-use feature names that oterwise are also a crate name.
Previously I thought that serde1
is for future-proofing and supporting multiple serde versions at the same time. However, it‘s most definitely a burden I wouldn’t want anyway, so using serde
seems to be the way to go into the future.
serde1
cargo feature to serde
and use the weak-deps cargo capability. (b83ee36
)91134a1
)30a1a71
)74cb5ee
)home
in env::home_dir()
(13edfe9
)8dbd0a6
)cdef398
)19338d9
)23ee47f
)3d47919
)gix-path
for obtaining some shared directories as base for path generation. (da9009f
)d0052c1
)f9ad837
)6932017
)38eed1d
)d47cebe
)d1e5e12
)d1bd513
)02c4659
)cc48c35
)e965b18
)877951a
)gix_quote::ansi_c::undo()
.allow to ignore IO errors when reading configuration files. Sometimes, IO errors can occour consistently when reading from certain paths (on Windows, really), and it should be possible to not only see which path that is but also to ignore them entirely.
Now IO errors contain the path of the failed configuration file. There is also a new option flag to ignore errors (off by default).
5dc1f9f
)3016a28
)ee36e5b
)serial_test
no default features) (8f2accd
)typos
tool. (2321eb9
)01277a6
)A maintenance release without user-facing changes.
29a0870
)e06f5f5
)A maintenance release without user-facing changes.
93e75fe
)895e482
)0f411e9
)A maintenance release without user-facing changes.
ea9fd1d
)e6cc618
)addd789
)94c99c7
)56c005b
)8ef1cb2
)A maintenance release to restore MSRV (1.64) support.
add File::write_to_filter()
to have a filter select the section to write. This way, one can selectively write sections to a file, based on the section's origin or other meta-data.
For convenience sake, most mutating methods on SectionMut
can now be chained as well.
add File::set_meta()
to affect what metadata new sections receive. That way it's possible to better control the metadata associated with new sections, given that the config file metadata may not truly reflect its identity anymore since it can be a combination from many different files with various sources.
note that crates have been renamed from git-*
to gix-*
. This also means that the git-*
prefixed crates of the gitoxide
project are effectively unmaintained. Use the crates with the gix-*
prefix instead.
If you were using git-repository
, then gix
is its substitute.
File::section(...)
could panic due to invlid expectation. This has been fixed to prevent panics.
compatibility with bstr
v1.3, use *.as_bytes()
instead of .as_ref()
. as_ref()
relies on a known target type which isn‘t always present. However, once there is only one implementation, that’s no problem, but when that changes compilation fails due to ambiguity.
9604783
)bstr
v1.3, use *.as_bytes()
instead of .as_ref()
. (135d317
)c56d336
)A maintenance release without user-facing changes.
File::set_raw_[multi_]value()
to ::set_existing_raw_[multi_]value
. This makes clear that the method will fail if the value doesn't yet exist.File::raw_multi_value()
to File::raw_values()
File::raw_multi_value_mut()
to File::raw_values_mut()
File::multi_value()
to File::values()
. The latter is better in line with string()/strings()
subsections are identified as &BStr
in entire API. Technically they can be any value (except for newlines and unescaped double quotes), and these values might be paths and everything that comes with it, like illformed UTF8. In order to be able to represent everything that git can represent, we don't enforce UTF8 anymore for subsection names.
Note that section names and key names are required to be valid UTF8 (and even alphanumeric ascii), which makes illformed UTF8 very unlikely there.
Simplify specifying keys when mutating config values.
File::rename_section()
with validation of input arguments.
improve normalization; assure no extra copies are made on query. We now return our own content, rather than the originals with their lifetimes, meaning we bind lifetimes of returned values to our own File
instance. This allows them to be referenced more often, and smarter normalization assures we don't copy in the simple cases either.
More tests were added as well. This is breaking as lifetime changes can cause distruptions, and values?_as()
was removed as well as it‘s somewhat duplicate to higher-level APIs and it wasn’t tested at all.
Remove git-config
test utilities from git-path
.
transfer knowledge about configuration and its usage into the type system. That way it's possible to use configuration overrides, even though ultimately being strings, in a type-safe manner and leverage code-completion while at it.
In that process, we also change Repository::(committer|Author)()
to return Option<Result<...>>
to be able to account for date parse errors.
File::new_section()
and related now returns their id
as well. That way it's possible to more easily interact with it later, for instance when one wants to delete it.
upgrade edition to 2021 in most crates. MSRV for this is 1.56, and we are now at 1.60 so should be compatible. This isn‘t more than a patch release as it should break nobody who is adhering to the MSRV, but let’s be careful and mark it breaking.
Note that git-features
and git-pack
are still on edition 2018 as they make use of a workaround to support (safe) mutable access to non-overlapping entries in a slice which doesn't work anymore in edition 2021.
file::SectionMut::push()
now supports values without key-value separator. These make a difference as those without =
are considered boolean true. Currently pushing onto a section is the only way to write them.
Support for lossy
load mode. There is a lot of breaking changes as file::from_paths::Options
now became file::init::Options
, and the same goes for the error type.
add _filter()
versions to most access methods. That way it's possible to filter values by their origin.
Note that the remove_section()
methods now return the entire removed section, not just the body, which yields more information than before including section metadata.
section names are now validated.
filtering supportort for parse::Events
. That way it's possible to construct Files which are not destined to be written back as they only keep events necessary for value access, greatly reducing allocations.
change mostily internal uses of [u8] to BString/BStr
Path-interpolation makes home-dir
configurable. That way the caller has full control over how the environment is used, which also allows more fine-grained control over which config files can be included.
Make realpath()
easier to use by introducing realpath_opt()
. That way there is consistency about how many symlinks to follow.
Add Kind::GitInstallation
for a way to obtain special git-installation configuration paths. Note that these are lazily cached as they call the git
binary.
upgrade bstr
to 1.0.1
Add File::set_raw_value()
to unconditionally set single values, and make the value itself easier to provide.
add File::resolve_includes()
and move its error type to file::includes
.
add File::from_bytes_owned()
and remove File::from_path_with_buf()
remove File::from_env_paths()
. It's replaced by its more comfortable new_globals()
.
untangle file::init::…
Option
and Error
types. This moves types to where they belong which is more specific instead of having a catch-all Error
and Options
type.
rename parse::Comment::(comment_tag|comment)
to ::tag|text
and parse::Section::section_header
to ::header
.
Associate file::Metadata
with each File
. This is the first step towards knowing more about the source of each value to filter them based on some properties.
This breaks various methods handling the instantiation of configuration files as file::Metadata
typically has to be provided by the caller now or be associated with each path to read configuration from.
rename file::SectionBody
to file::section::Body
.
Remove File::sections_by_name_with_header()
as ::sections_by_name()
now returns entire sections.
create resolve_includes
options to make space for more options when loading paths.
rename path::Options
into path::Context
. It‘s not an option if it’s required context to perform a certain operation.
All accessors in File
are now using impl AsRef<str>
where possible for added comfort.
Much more comfortable API file::*Mut
types thanks to impl Into/AsRef
.
Rename Mutable*
into $1Mut
for consistency.
conform APIs of file::MutableValue
and file::MutableMultiValue
. There are more renames and removals than worth mentioning here given the current adoption of the crate.
rename file::MutableSection::set_leading_space()
to set_leading_whitespace()
. The corresponding getter was renamed as well to leading_whitespace()
.
Enforce parse::section::Header::new()
by making its fields private.
Add File::write_to()
and File::to_bstring()
; remove some TryFrom
impls. Now File
can be serialized in a streaming fashion and without the possibility for UTF8 conversion issues.
Note that Display
is still imlpemented with the usual caveats.
remove Integer::to_bstring()
as well as some TryFrom
impls. Note that it can still display itself like before via std::fmt::Display
.
remove Boolean::to_bstring()
along with a few From
impls. These were superfluous and aren't useful in practice. Note that serialization is still implemented via Display
.
allocation free File::sections_by_name()
and File::sections_by_name_with_header()
.
Path::interpolate()
now takes path::interpolate::Options
instead of three parameters.
remove String
type in favor of referring to the File::string()
method. The wrapper had no effect whatsoever except for adding complexity.
Simplify Boolean
to be a wrapper around bool
. Previously it tried hard not to degenerate information, making it a complicated type.
However, in practice nobody cares about the exact makeup of the boolean, and there is no need to serialize a boolean faithfully either.
Instead, those who want to set a value just set any value as a string, no need for type safety there, and we take care of escaping values properly on write.
Use bitflags for color::Attribute
instead of Vec
of enums. This is less wasteful and sufficient for git, so it should be sufficient for us, especially since attributes are indeed a set and declaring one twice has no effect.
simplify Color
API. For now we only parse and serialize for display, but more uses are enabled when needed and trivially.
remove parse::Events::from_path
and File::at
The latter has been replaced with File::from_path_with_buf(…)
and is a low-level way to load just a single config file, purposefully uncomfortable as it will not resolve includes.
The initialization API will need some time to stabilize.
Slim down API surface of parse::Events
. It's more of a ‘dumb’ structure now than before, merely present to facilitate typical parsing than something special on its own.
remove File::new()
method in favor of File::default()
.
rename parse::event::List
to parse::Events
rename parse::State
to parse::event::List
move value::*
into the crate root, except for Error
and normalize_*()
.
rename value::parse::Error
to value::Error
.
rename value::TrueVariant
to value::boolean::True
rename IntegerSuffix
to integer::Suffix
rename value::Color(Attribute|Value)
to value::color::Attribute
and value::color::Name
.
Turn parse::ParseOrIoError
into parse::state::from_path::Error
rename parse::ParsedComment
into parse::Comment
rename parse::Section*
related types. These are now located in section::*
.
rename parse::Parser
to parse::State
. Furthermore, make State
the entry point for all parsing, removing all free-standing functions that returned a State
.
rename parser
module to parse
rename normalize_cow()
to normalize()
and move all normalize*
functions from values
to the value
module
move Path
from values
to value
module
Move Boolean
and String
from values
into value
module
move values::Integer
into value
module
move Color
to own value
module
remove values::Bytes
- use values::String
instead. Note that these values are always normalized and it's only possible to get a raw values using the raw_value()
API.
File::len()
-> File::num_values()
The same is true for Section::len()
which now is Section::num_values()
.
GitConfig::from_paths(…, <option>)
is now owned. The type is Copy
, so no need to pass it by reference.
remove values::*Error
in favor of value::parse::Error
. This makes it easier to work with errors in practice, we are either interested in the value that failed to parse to try something else or want a nice user message.
Having one decode error type facilitates that.
switch from quickerror to thiserror. This allows for generic types for sources of errors and allows to workaround a limitation with associated type constraints in the MSRV of 1.54.
Using thiserror makes this work and brings the crate more closely to the rest of the gitoxide crates (which now prefer thiserror over quickerror).
remove all get_
prefixes from methods That way the API is more idiomatic and fits better into the existing gitoxide
crates.
use lookup::Error
and lookup::existing::Error
Use the newly introduced structured error to replace the ‘catch-all’ GitConfigError
while getting closer to naming conventions in other gitoxide
crates.
git_config::values::Value
; use Bytes
in its place. :Events::from_bytes()with
filter` support.
Include benches in crate to allow publishing to work
remove clippy-cargo lint until there are no warnings Please feel free to re-add once all other git-* crates have been adjusted. It's interesting to see how a crate lint spills into the workspace.
Personally I am surprised that the keywords value is supposed to repeat the crate name as it seems redundant.
remove redundant lines from git-ignore file
File::section(...)
could panic due to invlid expectation. This has been fixed to prevent panics.
File::boolean()
now correctly handles implicit bools across sections. This means it will return the last implicit value as true, instead of ignoring it to fall back onto an explicit boolean value that might be false.
file::SectionMut::push()
now properly creates empty values. Previously, when calling .push("key", None)
, the resulting internal state would be slighly wrong causing certain invariants and expectations to be unfulfilled even though it might have looked OK to most users.
Now it will uphold the invariant for empty values, those without an =
character.
greatly improve whitespace handling when removing values. Previously, newlines would remain past a value, and whitespace could remain before one.
Now both are removed to simulate removing an actual line.
File::remove_section()
was fixed to allow re-adding a similarly named section. We also add File::remove_section_by_id()
to make it possible to remove specific sections.
Properly handle boolean values such that a
is true but a=
is false. This is even consistent when no booleans are used, such that a
has no value as if it is not present, it's only available for booleans which must be specified.
Keep track of a severe limitation and prepare tests for fixing it. This also changes behaviour, but merely removes a hack in Boolean
which considered empty strings true, even though they are supposed to be false.
maintain insertion order of includes on per-section basis at least. Note that git inserts values right after the include directive, ‘splitting’ the section, but we don't do that and insert new values after the section. Probably no issue in practice while keeping our implementation simple.
maintain newline format depending on what‘s present or use platform default. Previously implicit newlines when adding new sections or keys to sections was always \n
which isn’t correct on windows.
Now the newline style is detected and used according to what‘s present, or in the lack of content, defaults to what’s correct for the platform.
validate incoming conifguration keys when interpreting envirnoment variables.
Boolean
can use numbers to indicate true or false, drops support for one
and zero
.
file::MutableSection::remove()
now actually removes keys and values.
file::MutableMultiValue
escapes input values and maintains key separator specific whitespace.
value normalization (via value::normalize()
handles escape sequences. The latter ones are \n
, \t
and \b
which are the only supported ones in values of git-config files.
stable sort order for File::sections_by_name_with_header()
count newlines (for error display) in multi-line values as well
auto-normalize string values to support quote removal in case of strings. Related to https://github.com/starship/starship/pull/3883 .
Use std::env::var_os()
to avoid potential decode errors
fix usage example in README.md
add File::write_to_filter()
to have a filter select the section to write. This way, one can selectively write sections to a file, based on the section's origin or other meta-data.
For convenience sake, most mutating methods on SectionMut
can now be chained as well.
add File::set_meta()
to affect what metadata new sections receive. That way it's possible to better control the metadata associated with new sections, given that the config file metadata may not truly reflect its identity anymore since it can be a combination from many different files with various sources.
SectionMut::push_with_comment(key, comment)
to add a new variable with a comment. This is useful for providing more information about a value at hand, especially if it was added programmatically and then shows up in the configuration.
Add the Source::EnvOverride
to have a place for ‘terminal’ overrides. That way environment variables represented via git-configuration can be integrated into git configuration, making clearer what's going to happen even when looking at the configuration via gix config
.
The implementation has to be careful though about assureing there is no more specific configuration key, like http.<URL>.proxy
that would override the one from the environment, which always has the final word.
comfort API like string_by_key(key)
takes a key like "remote.origin.url"
, add section_by_key("remote.origin")
as well. That way it's the most comfortable way to query values and very similar to how git does it, too.
Additionally, sections can be obtained by section key, both mutably and immutably for completeness.
read worktree specific configuration of main worktrees. Supporting this is useful when interacting with worktrees that have been created with sparse worktree support, which moves some configuration values into those for the worktree at hand.
Note that linked worktrees are not supported - for that use git-repository
instead.
add parse::section::header::is_valid_subsection()
function. It can be useful to validate subsection names without having to construct an entire Header
(which also includes a name).
Add various methods to iterate sections along with their id, and mutate them. As section names are not unique, it was previously not possible to iterate sections and then mutate them as one wouldn't be able to refer to the exact section that was just traversed, after all, there can be many sections named remote "origin"
.
With the new methods it's possible to uniquely refer to each section for mutation and removal.
File::set_raw_value_filter()
to set values only in sections passing a filter.
File::section_mut_or_create_new_filter()
to allow chosing which sections to add values to.
File::section_mut_or_create_new(…)
to obtain an existing or new section for mutation.
use docsrs feature in code to show what is feature-gated automatically on docs.rs
pass --cfg docsrs when compiling for https://docs.rs
following includes is now non-fatal by default Otherwise it would be relatively easy to fail gitoxide startup, and we want to be closer to the behaviour in git which ignores most of the errors.
File::from_git_dir()
as comfortable way to instantiate most complete git configuration.
File
now compares actual content, ignoring whitespace and comments.
File::new_environment_overrides()
to easily instantiate overrides from the environment.
File::new_globals()
can instantiate non-local configuration with zero-configuration.
Source::storage_location()
to know where files should be located.
file::ValueMut::(section|into_section_mut)()
to go from value to the owning section. This can be useful if the value was obtained using raw_value_mut()
.
Source::is_in_repository()
to find out if a source is in the repository.
parse::key
to parse a remote.origin.url
-like key to identify a value
Add File::detect_newline_style()
, which does at it says.
File::frontmatter()
and File::sections_and_postmatter()
.
parse::Event::to_bstr_lossy()
to get a glimpse at event content.
File::append()
can append one file to another rather losslessly. The loss happens as we, maybe for the wrong reasons, automatically insert newlines where needed which can only be done while we still know the file boundaries.
file::Section::meta()
to access a section's metadata.
File::sections()
to obtain an iterator over all sections, in order.
place spaces around key = value
pairs, or whatever is used in the source configuration.
proper escaping of value bytes to allow round-tripping after mutation
whitespace in newly pushed keys is derived from first section value. That way, newly added key-value pairs look like they should assuming all keys have the same indentation as the first key in the section.
If there is no key, then the default whitespace will be double-tabs like what's commmon in git.
File::from_str()
implementation, to support let config: File = "[core]".parse()?
whitespace in mutable sections can be finely controlled, and is derived from existing sections
parse::Header::new(…)
with sub-section name validation
Add parse::(Event|section::Header|Comment)::write_to(…)
. Now it's possible to serialize these types in a streaming fashion and without arbitrarily enforcing UTF-8 on it
serde1
feature to add limited serde support
GitConfig::integers()
Get multiple fully validated integer values, with their suffix interpreted and checked for overflow.
add GitConfig::integer()
A way to quickly obtain a valid integer with suffixes resolved and overflow checked.
GitConfig::strings()
for multi-value strings.
GitConfig::path()
for direct access to paths. Very similar to string()
, but as path, whose query can never fail.
support for try_value()
, boolean()
and string()
access. Support for a convenient way of knowing if a value does or doesn't exist via
try_value()`, which can only fail if the conversion fails.
Lastly, string()
is a special case which doesn't fail as there is no conversion, and boolean()
allows to obtain a plain boolean value if it was a valid boolean representation.
new hierarchical errors for value lookup
add suppport for android Do not interpolate ~user/
on Android (Termux). There is no meaning of it. It is single user system.
Add git_config::values::Path
for a typesafe git path Add a Path
type to the git_config::values
which can be interpolated according to gits own path interpolation rules.
implement a draft for subsection fetching
sections_by_name_with_header
to allow iterating over tuples of section header and section bodygit-config
now uses git-config-value
.GitConfig::from_paths(<paths>, …)
accepts more inputs <paths>
is more flexible and is easier to use.47d8162
)6776a3f
)8adf0d8
)84cb256
)4163c7f
)a359cfd
)GitConfig::from_paths(…, <option>)
is now owned. (c7fcb5e
)std::env::var_os()
to avoid potential decode errors (36e2fc0
)GitConfig::from_paths(<paths>, …)
accepts more inputs (b04a346
)72a5a02
)GitConfig::integers()
(4726bb5
)GitConfig::integer()
(ae22a4d
)c139479
)4408f17
)GitConfig::strings()
for multi-value strings. (bfc2637
)7ea17e1
)43a34a5
)97e53f6
)GitConfig::path()
for direct access to paths. (7c75eac
)values::*Error
in favor of value::parse::Error
. (38dfdcf
)4612fca
)732c0fa
)try_value()
, boolean()
and string()
access. ([
dc3dc3b`](https://github.com/Byron/gitoxide/commit/dc3dc3b41b5de3ec17429769747bf99bb2bdd03d))4496b5a
)a98a7a7
)8aef1d3
)get_
prefixes from methods (a86b254
)lookup::Error
and lookup::existing::Error
(f9aaac1
)13554f8
)cc2d810
)f158648
)git-path
crate instead of git_features::path
(47e607d
)5fc5459
)50ff7aa
)06b86e0
)4dc6594
)5e0f889
)330d0a1
)Permissions
as there is no need for that here. (1954ef0
)1bc96bf
)989603e
)File::from_git_dir()
as comfortable way to instantiate most complete git configuration. (f9ce1b5
)acb4520
)ec21e95
)Env
test utility into git-testtools
(bd3f4d0
)b073e29
)e4d8fd7
)dac1463
)cfda0c3
)3d89a46
)8a7fb15
)fbcf40e
)97e5ede
)ee10dd5
)9c248ee
)File
now compares actual content, ignoring whitespace and comments. (14a68a6
)6c1588f
)f5580a3
)4e47df5
)File::resolve_includes()
and move its error type to file::includes
. (17c83d5
)File::from_bytes_owned()
and remove File::from_path_with_buf()
(5221676
)from_paths_metadata()
. (612645f
)61ecaca
)File::new_environment_overrides()
to easily instantiate overrides from the environment. (7dadfd8
)45c964a
)File::from_env_paths()
. (98d45c2
)File::new_globals()
can instantiate non-local configuration with zero-configuration. (146eeb0
)Source
in accordance for what git actually does. (97374e4
)Source::storage_location()
to know where files should be located. (e701e05
)file::ValueMut::(section|into_section_mut)()
to go from value to the owning section. (fff0884
)Source::is_in_repository()
to find out if a source is in the repository. (f5f2d9b
)parse::key
to parse a remote.origin.url
-like key to identify a value (91e718f
)f7bd2ca
)3c06f88
)File::detect_newline_style()
, which does at it says. (26147a7
)78e85d9
)5e8127b
)88c6b18
)file::init::…
Option
and Error
types. (230a523
)lossy
load mode. (d003c0f
)with
filter support. ([
32d5b3c`](https://github.com/Byron/gitoxide/commit/32d5b3c695d868ba93755123a25b276bfbe55e0a))a50a396
)File::frontmatter()
and File::sections_and_postmatter()
. (0ad1c9a
)_filter()
versions to most access methods. (1ea26d8
)50c1753
)df94c67
)parse::Comment::(comment_tag|comment)
to ::tag|text
and parse::Section::section_header
to ::header
. (3f3ff11
)parse::Event::to_bstr_lossy()
to get a glimpse at event content. (fc7e311
)c70e135
)25ed92e
)File::append()
can append one file to another rather losslessly. (09966a8
)4665e87
)file::Section::meta()
to access a section's metadata. (56ae574
)d60025e
)File::sections()
to obtain an iterator over all sections, in order. (6f97bf0
)file::Metadata
with each File
. (6f4eea9
)file::SectionBody
to file::section::Body
. (b672ed7
)File::sections_by_name_with_header()
as ::sections_by_name()
now returns entire sections. (3bea26d
)9aa5acd
)resolve_includes
options to make space for more options when loading paths. (41b3e62
)path::Options
into path::Context
. (cabc8ef
)207e483
)0d07ef1
)9750b7a
)9cb9acb
)Source
type to allow knowing where a particular value is from. (c92d5c6
)Boolean
can use numbers to indicate true or false, drops support for one
and zero
. (6b90184
)File
are now using impl AsRef<str>
where possible for added comfort. (3de0cfd
)file::*Mut
types thanks to impl Into/AsRef
. (3d25fe6
)Mutable*
into $1Mut
for consistency. (393b392
)file::MutableSection::remove()
now actually removes keys and values. (94dde44
)ac843cb
)701266e
)file::MutableValue
and file::MutableMultiValue
. (0a7391a
)file::MutableMultiValue
escapes input values and maintains key separator specific whitespace. (048b925
)key = value
pairs, or whatever is used in the source configuration. (5418bc7
)a7eff01
)15cd1d2
)511985a
)7e03b83
)8118644
)afa736a
)MutableValue
showing that it's too buggy right now (5e6f9d9
)file::MutableSection::set_leading_space()
to set_leading_whitespace()
. (83a0922
)9f59356
)File::from_str()
implementation, to support let config: File = "[core]".parse()?
(db1f34d
)9157717
)c88eea8
)a0d6caa
)ee9ac95
)59ec7f7
)a93a156
)File::rename_section()
with validation of input arguments. (895ce40
)9a2f597
)12cf005
)parse::section::Header::new()
by making its fields private. (219cf7a
)parse::Header::new(…)
with sub-section name validation (ae3895c
)cfd974f
)parse::section::Header
(00592f6
)00d1a9b
)9fac8e0
)78bb93c
)File::write_to()
and File::to_bstring()
; remove some TryFrom
impls. (4f6cd8c
)Integer::to_bstring()
as well as some TryFrom
impls. (0e392f8
)Boolean::to_bstring()
along with a few From
impls. (b22732a
)parse::(Event|section::Header|Comment)::write_to(…)
. (d087f12
)3d7fc18
)value::normalize()
handles escape sequences. (f911707
)cf3bf4a
)b92bd58
)file::mutating
(2d5703e
)File::sections_by_name_with_header()
(44dfec0
)file::raw
module (6acf4a4
)b979a3b
)eafc6ce
)7aa8a0b
)File::sections_by_name()
and File::sections_by_name_with_header()
. (65c520c
)2abffd6
)539c2f6
)f1668e9
)2599680
)879fad5
)b2b82da
)ba69124
)33efef6
)700d6aa
)Path::interpolate()
now takes path::interpolate::Options
instead of three parameters. (ac57c44
)from_env
(c8693f9
)a7d7751
)95fc20a
)a361c7f
)8e84fda
)File::raw_multi_value()
to File::raw_values()
(9cd9933
)File::raw_multi_value_mut()
to File::raw_values_mut()
(0076dcf
)File::multi_value()
to File::values()
. (a8604a2
)String
type in favor of referring to the File::string()
method. (0915051
)8fa7600
)b78e3fa
)home_for_user
in Path::interpolate(…)
. (f9e0ef3
)Boolean
to be a wrapper around bool
. (9cadc6f
)color::Attribute
instead of Vec
of enums. (703922d
)23ec673
)4f21d1e
)Color
API. (3fc4ac0
)c1b9cd4
)e2bd055
)1ea919d
)25b9760
)7474997
)637fe8f
)199e546
)3c29321
)117401d
)git-config::File
docs and rename some internal symbols (5a8b111
)910af94
)cdfb13f
)c95e0b9
)f5026fb
)parse::Events
. (6ba2f80
)ead757c
)e571fdb
)183c7ae
)git-config
(c52cb95
)parse::Events::from_path
and File::at
(14149ee
)52bd1e7
)ed00e22
)307c1af
)parse::Events
. (73adcee
)File::new()
method in favor of File::default()
. (2e47167
)c5c4398
)5022be3
)050d0f0
)2e149b9
)d3a0c53
)6c3f326
)cd7a21f
)4fb327c
)0f5c99b
)5958ffb
)2186456
)86e1a76
)parse::event::List
to parse::Events
(ea67650
)parse::State
to parse::event::List
(89f5fca
)19300d5
)4a01d98
)normalize
doesn't copy unnecessarily (ce069ca
)91ba2dd
)e684488
)git-config
(363a826
)value::*
into the crate root, except for Error
and normalize_*()
. (3cdb089
)value::parse::Error
to value::Error
. (748d921
)value::TrueVariant
to value::boolean::True
(7e8a225
)IntegerSuffix
to integer::Suffix
(8bcaec0
)value::Color(Attribute|Value)
to value::color::Attribute
and value::color::Name
. (d085037
)a0f7f44
)0845c84
)ef5b48c
)aeca6cc
)parse::ParseOrIoError
into parse::state::from_path::Error
(a0f6252
)parse::ParsedComment
into parse::Comment
(b6b31e9
)44d0061
)94608db
)parse::Section*
related types. (239cbfb
)git-config
(41bfd3b
)parse::Parser
to parse::State
. (60af4c9
)parser
module to parse
(3724850
)b05aed1
)8bd9cd6
)90dd2ce
)0d1be2b
)normalize_cow()
to normalize()
and move all normalize*
functions from values
to the value
module (58b2215
)26e4a9c
)serde1
feature to add limited serde support (5a8f242
)66a8237
)Path
from values
to value
module (767bedc
)Boolean
and String
from values
into value
module (6033f3f
)values::Integer
into value
module (d4444e1
)Color
to own value
module (38f3117
)d4fbf2e
)git_path
(4420ae9
)7d27dd5
)6001613
)adcddb0
)0229e25
)git
around GIT_CONFIG_*
env vars (53efbf5
)5c71394
)3af09e5
)a3b7828
)9d48b2f
)a922f0a
)d76aee2
)6366148
)b3a752a
)92fe564
)2b21a35
)83eda34
)9034bd4
)f943d2a
)1d07934
)ebe551f
)845fe37
)2862a07
)baa300f
)from_env()
include paths only use paths of the correct key (0d84ce8
)e94ded4
)0b032e4
)7204755
)85be984
)bcd038c
)a392988
)3e7ef3e
)049b243
)27085e0
)f0ff687
)f6d9693
)Path::interpolate()
more useful by returning an actual PathBuf
(86aa7b3
)a071ce8
)0666a35
)git_config::values::Path
for a typesafe git path (e4d6685
)Permissions
for git-config (8443330
)47079d4
)cb9529e
)File::boolean()
now correctly handles implicit bools across sections. (839f776
)21a5229
)file::SectionMut::push()
now properly creates empty values. (7d92c61
)041ede9
)git-ref
(d40beb3
)Kind::GitInstallation
for a way to obtain special git-installation configuration paths. (27fb1ce
)bstr
to 1.0.1
(99905ba
)git-config
now uses git-config-value
. (5ad2965
)9b28df2
)a
is true but a=
is false. (08c50a4
)7a871c2
)7c58516
)file::SectionMut::push()
now supports values without key-value separator. (b6cd6ac
)5415449
)File::set_raw_value_filter()
to set values only in sections passing a filter. (9937d0e
)File::section_mut_or_create_new_filter()
to allow chosing which sections to add values to. (17455c9
)File::set_raw_value()
to unconditionally set single values, and make the value itself easier to provide. (2b2357e
)File::section_mut_or_create_new(…)
to obtain an existing or new section for mutation. (5902f54
)File::set_raw_[multi_]value()
to ::set_existing_raw_[multi_]value
. (69ec594
)caa7a1b
)1ee9918
)rust-version
to 1.64 (55066ce
)8c0bca3
)41d57b9
)e313112
)6efd0d3
)6ccc88a
)c9275b9
)git-testtools
to gix-testtools
(b65c33d
)git-pack
to gix-pack
(1ee81ad
)git-odb
to gix-odb
(476e2ad
)git-index
to gix-index
(86db5e0
)git-diff
to gix-diff
(49a163e
)git-commitgraph
to gix-commitgraph
(f1dd0a3
)git-mailmap
to gix-mailmap
(2e28c56
)git-discover
to gix-discover
(53adfe1
)git-lfs
to gix-lfs
(b9225c8
)git-chunk
to gix-chunk
(59194e3
)git-bitmap
to gix-bitmap
(75f2a07
)git-protocol
to gix-protocol
(823795a
)git-refspec
to gix-refspec
(c958802
)git-revision
to gix-revision
(ee0ee84
)git-transport
to gix-transport
(b2ccf71
)git-credentials
to gix-credentials
(6b18abc
)git-prompt
to gix-prompt
(6a4654e
)git-command
to gix-command
(d26b8e0
)git-packetline
to gix-packetline
(5cbd22c
)git-worktree
to gix-worktree
(73a1282
)git-hashtable
to gix-hashtable
(26a0c98
)git-worktree
to gix-worktree
(108bb1a
)git-url
to gix-url
(b50817a
)git-date
to gix-date
(9a79ff2
)git-attributes
to gix-attributes
(4a8b3b8
)git-quote
to gix-quote
(648025b
)git-config
to gix-config
(3a861c8
)git-config
to gix-config
(dd6d63e
)git-ref
to gix-ref
(1f5f695
)git-lock
to gix-lock
(2028e78
)git-tempfile
to gix-tempfile
(b6cc3eb
)git-object
to gix-object
(fc86a1e
)git-actor
to gix-actor
(4dc9b44
)git-validate
to gix-validate
(5e40ad0
)git-hash
to gix-hash
(4a9d025
)git-features
to gix-features
(e2dd68a
)git-glob
to gix-glob
(35b2a3a
)git-sec
to gix-sec
(eabbb92
)git-path
to gix-path
(d3bbcfc
)git-config-value
to gix-config-value
(622b3e1
)109f434
)1ecfb7f
)74390ba
)446f866
)6461c3d
)git-repository
to gix
(7bed2a9
)c196d20
)7c846d2
)1e544e8
)39ed9ed
)9ab3e25
)bac57dd
)7bba270
)2faad43
)1fea18f
)5b5b380
)93bef97
)b93f0c4
)4fc214a
)b34c9fe
)9e04685
)8623b5a
)ffb5b6a
)4381a03
)0f7edc1
)git-repository
(d9b7df9
)0e3d0a5
)5ac9fbe
)30d8ca1
)e6b9906
)7114bbb
)c57bdde
)083909b
)git-testtools
(4eb842c
)747008d
)6b9632e
)File::new_section()
and related now returns their id
as well. (2b36d99
)SectionMut::push_with_comment(key, comment)
to add a new variable with a comment. (5b9bffe
)7893502
)Source::EnvOverride
to have a place for ‘terminal’ overrides. (e4bf8f0
)10f4f21
)string_by_key(key)
takes a key like "remote.origin.url"
, add section_by_key("remote.origin")
as well. (5fa9546
)&BStr
in entire API. (0c98ec8
)bcd9654
)b2c301e
)e4648f8
)0e4462d
)7d7bd02
)747b9e9
)3d8fa8f
)0c253b1
)fe5721f
)166f349
)aab6a33
)9d8cb1f
)d071583
)423af90
)5406630
)04cfa63
)a93c470
)c4e6849
)ea2136b
)def53b3
)d2f56df
)104d922
)d232567
)aa80b60
)7b9c065
)507dc7e
)parse::section::header::is_valid_subsection()
function. (aa5d66f
)9c1e639
)5df2a2a
)File::remove_section()
was fixed to allow re-adding a similarly named section. (e533993
)769e897
)702a161
)3c49400
)82fd251
)25a7726
)29a043b
)429cccc
)3773b92
)fd14489
)c9eda72
)windows
(2968181
)535e967
)5c05198
)9aa1d3d
)1d4600a
)bc64b96
)c48fb31
)cef0b51
)85a3bed
)baad4ce
)c2660e2
)cfa1440
)4974eca
)5e82346
)39d585d
)2770431
)e2ee3de
)31c2351
)b1c40b0
)f7f136d
)5176771
)bd5f3e8
)c96473d
)c06ae1c
)8f5f3ab
)232784a
)a938986
)de61c4d
)4bd747c
)ce885ad
)9b9ea02
)6da8250
)237b21d
)7b61506
)1dd9f9a
)47724c0
)4e7b343
)e9fcb70
)aa639d8
)4737b1e
)3c50625
)f144eaf
)fddc720
)15a379a
)15fee74
)0b05be8
)b420eba
)fd046f4
)693e304
)a741766
)453e9bc
)5d0a5c0
)e5ba0f5
)00bfbca
)09e2374
)e842633
)085e76b
)84b98d9
)3ca8027
)aa9fdb0
)20e188f
)c9a2390
)badd00c
)0700b09
)b246f0a
)08441de
)8b29dda
)cff6e01
)f7be3b0
)7a2a31e
)6f4f325
)git-url
and git-config
(1f02420
)9b6a67b
)values::Bytes
- use values::String
instead. (aa630ad
)311d4b4
)146eb0c
)a0f842c
)f4fe879
)16778d4
)89ea12b
)c26c2e9
)27b2dde
)2eda529
)daa71c3
)937d7ee
)4e8cc7a
)7d1cf34
)1e71e71
)02fba2c
)1d6ba9b
)c2d7e80
)b5c0b30
)5f11318
)f0e6ea9
)62e5396
)target_os = "windows"
in favor of cfg(windows)
and negations (91d5402
)556c7cf
)08af648
)cfe196b
)47f10fe
)e0a72e6
)34bb715
)dirs
crate (0e8cf19
)180ce99
)00ba5d8
)0eb7ced
)home-dir
configurable. (edd2267
)aab9865
)a40e3c9
)67677b0
)7be0b05
)1203a14
)a721efe
)2c8c6e5
)eb0ace1
)8f8f873
)41ea8ba
)400c9be
)git-config
test utilities from git-path
. (c9933c0
)ed5c442
)f2e124f
)a41002f
)8de6b3d
)a417177
)bb424f5
)cd4f727
)ec40b94
)82ea726
)dirs::home_dir()
(5767a50
)393758e
)db1204d
)52db5e8
)c3a0454
)22e5cbe
)pwd
crate dependency in favor of using libc directly (4adfa11
)475d6fa
)5aaf7ba
)cfa577f
)da23958
)26680c4
)11c417f
)31e6db8
)b4374d2
)04da720
)8891fea
)ca05802
)ab555b5
)bb3b4f0
)e1ba36f
)315c87e
)e47fb41
)56eadc8
)0ccd8ae
)e2e94db
)b4e657e
)c078671
)realpath()
easier to use by introducing realpath_opt()
. (266d437
)984b58e
)d5d81bc
)a4a7ebd
)a342e53
)a22b1d8
)ceb6dff
)53adcfe
)cf24fbe
)File
type (f1f69d8
)81aca45
)1fe053f
)409a95b
)file
module (2d4a19b
)6cc5c20
)3471f95
)File::len()
-> File::num_values()
(553f872
)2626e0c
)07e0f5e
)a85d864
)e0d063e
)ed5de9e
)9b70eca
)b02d147
)4098278
)17a296f
)a29657a
)07bc9a8
)598c853
)300ecbc
)654cf39
)6f35866
)fd24e2c
)5d74404
)15ac22a
)0426f4d
)da13aff
)05eb340
)7cb1972
)538de54
)options_with_git_dir()
. (9abbac1
)60da03c
)4d0e29c
)0e01da7
)98da8ba
)5bf6b52
)53f27e0
)1e2b239
)8382df2
)5dd3f92
)2c78e48
)a955449
)d774485
)546ec2c
)std::path::MAIN_SEPARATOR
when adding ** globbing. (b85e706
)std::path::MAIN_SEPARATOR
when adding ** globbing. (cc42edf
)git-glob
for pattern matching. (6066701
)35f955a
)e6ef931
)293e86e
)7a59791
)fd2b085
)32c5729
)892b77a
)5d86a02
)aff2777
)39046e9
)9679d6b
)cd723b5
)4086335
)031bd2f
)e90d3fd
)273895a
)322f825
)61c5285
)001862a
) values as simple decimal numbers. ([
03f360a`](https://github.com/Byron/gitoxide/commit/03f360a19d365f614e71948df7e8b0c62d13cff4))ee4ad7e
)09c8628
)8b9432c
)b612021
)7887d8b
)ddfe833
)a6460db
)f0cbb24
)b2a88a5
)babaa9f
)714ef5c
)7cf3545
)b2df941
)a87844a
)3cbe072
)7fd8369
)e303466
)2d5768d
)GitConfigFromEnvError
with from_env::Error
. (e1f8b52
)from_env
. Follow duplicate include paths until max include depth is exceeded. (2295dc5
)9692694
)git_config::values::Value
; use Bytes
in its place. (55c00d8
)e8383ca
)c72ca00
)ae4f122
)3b55f25
)fefb01b
)a605b67
)469406d
)e348b2b
)e822f56
)8f57c29
)d78aab7
)373cbc8
)8900d69
)61af06b
)7dd2313
)d3f9227
)acd3737
)ec38950
)126aeec
)db1bb99
)GitConfig::from_env_paths
with git-like sequence resolution (aec51a2
)f606fa9
)f69b2d6
)39b40c8
)8441e92
)75879b0
)4b00d68
)e700284
)960dcdc
)f3bcefb
)763266d
)03541c5
)0cfe8a4
)bfcad07
)be4a4ea
)bbce210
)cdf88e6
)a424d5a
)59ffbd9
)cb72bef
)0456142
)0ad6438
)d743ef8
)a64d312
)a864812
)c33b498
)b1b6fe0
)dfbb015
)509c938
)57203ce
)2a2a89f
)9b9ffa3
)150ed76
)cc50249
)2fd23ed
)96461ac
)dc58eca
)f0aa3e1
)8ff83e5
)535ff79
)1ab44c0
)1a2f408
)0bd05b2
)05687b4
)b4302cd
)b559dd0
)dbcd79a
)50f9122
)d37b17c
)eb44cf6
)f05a669
)319a4ae
)ad41ba6
)70f9403
)bf0004e
)9c275dc
)15ae2d7
)392c131
)042eaf4
)515d256
)17e30a1
)27df3d1
)aa86594
)da40593
)a77a71c
)e1964e4
)a799ca8
)aa79924
)3e943f2
)6200ed9
)2006acb
)e583f70
)17258cc
)ac1a433
)ca96be1
)aec7240
)d899df0
)71aff75
)1c555e0
)63bee9c
)1f7a533
)e316c8c
)6387aea
)949622e
)bcacfc9
)41f118d
)1655b56
)3d62449
)4975fff
)adfa460
)81271e2
)84e959d
)41da7ed
)11cf526
)b0cf849
)f409931
)0aad0f1
)21b4fe1
)357a761
)c2fa869
)a19c17f
)c39ff33
)8cfe67d
)377532c
)bb7a544
)68320ca
)e7bad2e
)a1f833c
)9b54a5b
)4d7da4e
)014776f
)fc4ee85
)7c01808
)faa1b93
)635e5c1
)79eeca1
)01b617d
)87057c9
)b0ff69e
)a909bcf
)d45af63
)4f425a7
)ccadf89
)6e5b67b
)13fdda5
)5952cab
)ba982b9
)e0a8b8d
)7caf012
)a965ebc
)18c9dff
)7d0e6b4
)9fc8993
)8e32d56
)9767b5b
)1cf1f3b
)ec63ce6
)7e8ae93
)6c245dc
)236d37b
)bc63005
)ca7c1dc
)ce9b7bf
)a4ce9b0
)e10a4a2
)24a2dfd
)93b85e3
)8b68fdb
)4027daf
)0c226ad
)8618c22
)819a1d3
)45d5250
)d173b4b
)f293334
)41245eb
)568d360
)89791fd
)cf41bb3
)954f433
)afe4ac7
)0353033
)53077bd
)79dc19f
)5defc4a
)5b7cc13
)0cc9cd6
)b0fc08b
)ec2602c
)df0da82
)b59a51a
)e43518e
)ff8ee4a
)1d8e58b
)897450c
)0ea6210
)4b7f218
)a516885
)f66e0be
)b820d6c
)8ea467e
)3f708ec
)2691756
)eb07890
)d721625
)a4d2a4b
)b7790b4
)9676db9
)7136854
)14b17e4
)5ab4bdb
)8d933cb
)157fa2a
)475a68c
)bc008c3
)5a54dae
)8f00063
)32cc684
)83a1b83
)acb8947
)06679d9
)b5fa727
)0b52eb0
)99214f4
)84e0d19
)eb5a534
)3846bab
)e2a39c9
)3539531
)transfer knowledge about configuration and its usage into the type system. That way it's possible to use configuration overrides, even though ultimately being strings, in a type-safe manner and leverage code-completion while at it.
In that process, we also change Repository::(committer|Author)()
to return Option<Result<...>>
to be able to account for date parse errors.
A maintenance release without user-facing changes.
A maintenance release without user-facing changes.
A maintenance release without user-facing changes.
SectionMut::push_with_comment(key, comment)
to add a new variable with a comment. This is useful for providing more information about a value at hand, especially if it was added programmatically and then shows up in the configuration.
Add the Source::EnvOverride
to have a place for ‘terminal’ overrides. That way environment variables represented via git-configuration can be integrated into git configuration, making clearer what's going to happen even when looking at the configuration via gix config
.
The implementation has to be careful though about assuring there is no more specific configuration key, like http.<URL>.proxy
that would override the one from the environment, which always has the final word.
comfort API like string_by_key(key)
takes a key like "remote.origin.url"
, add section_by_key("remote.origin")
as well. That way it's the most comfortable way to query values and very similar to how git does it, too.
Additionally, sections can be obtained by section key, both mutably and immutably for completeness.
File::new_section()
and related now returns their id
as well. That way it's possible to more easily interact with it later, for instance when one wants to delete it. subsections are identified as &BStr
in entire API. Technically they can be any value (except for newlines and unescaped double quotes), and these values might be paths and everything that comes with it, like illformed UTF8. In order to be able to represent everything that git can represent, we don't enforce UTF8 anymore for subsection names.
Note that section names and key names are required to be valid UTF8 (and even alphanumeric ascii), which makes illformed UTF8 very unlikely there.
read worktree specific configuration of main worktrees. Supporting this is useful when interacting with worktrees that have been created with sparse worktree support, which moves some configuration values into those for the worktree at hand.
Note that linked worktrees are not supported - for that use gix
instead.
upgrade edition to 2021 in most crates. MSRV for this is 1.56, and we are now at 1.60 so should be compatible. This isn‘t more than a patch release as it should break nobody who is adhering to the MSRV, but let’s be careful and mark it breaking.
Note that gix-features
and gix-pack
are still on edition 2018 as they make use of a workaround to support (safe) mutable access to non-overlapping entries in a slice which doesn't work anymore in edition 2021.
A maintenance release without user-facing changes.
File::boolean()
now correctly handles implicit bools across sections. This means it will return the last implicit value as true, instead of ignoring it to fall back onto an explicit boolean value that might be false.
file::SectionMut::push()
now properly creates empty values. Previously, when calling .push("key", None)
, the resulting internal state would be slightly wrong causing certain invariants and expectations to be unfulfilled even though it might have looked OK to most users.
Now it will uphold the invariant for empty values, those without an =
character.
add parse::section::header::is_valid_subsection()
function. It can be useful to validate subsection names without having to construct an entire Header
(which also includes a name).
Add various methods to iterate sections along with their id, and mutate them. As section names are not unique, it was previously not possible to iterate sections and then mutate them as one wouldn't be able to refer to the exact section that was just traversed, after all, there can be many sections named remote "origin"
.
With the new methods it's possible to uniquely refer to each section for mutation and removal.
greatly improve whitespace handling when removing values. Previously, newlines would remain past a value, and whitespace could remain before one.
Now both are removed to simulate removing an actual line.
File::remove_section()
was fixed to allow re-adding a similarly named section. We also add File::remove_section_by_id()
to make it possible to remove specific sections.
gix-config
now uses gix-config-value
.Kind::GitInstallation
for a way to obtain special git-installation configuration paths. Note that these are lazily cached as they call the git
binary.bstr
to 1.0.1
Maintenance release without user-facing changes.
File::set_raw_value_filter()
to set values only in sections passing a filter.File::section_mut_or_create_new_filter()
to allow choosing which sections to add values to.File::section_mut_or_create_new(…)
to obtain an existing or new section for mutation.a
is true but a=
is false. This is even consistent when no booleans are used, such that a
has no value as if it is not present, it's only available for booleans which must be specified.Boolean
which considered empty strings true, even though they are supposed to be false.File::set_raw_value()
to unconditionally set single values, and make the value itself easier to provide.file::SectionMut::push()
now supports values without key-value separator. These make a difference as those without =
are considered boolean true. Currently pushing onto a section is the only way to write them.File::set_raw_[multi_]value()
to ::set_existing_raw_[multi_]value
. This makes clear that the method will fail if the value doesn't yet exist.A maintenance release without user facing changes.
following includes is now non-fatal by default Otherwise it would be relatively easy to fail gitoxide startup, and we want to be closer to the behaviour in git which ignores most of the errors.
File::from_git_dir()
as comfortable way to instantiate most complete git configuration.
File
now compares actual content, ignoring whitespace and comments.
File::new_environment_overrides()
to easily instantiate overrides from the environment.
File::new_globals()
can instantiate non-local configuration with zero-configuration.
Source::storage_location()
to know where files should be located.
file::ValueMut::(section|into_section_mut)()
to go from value to the owning section. This can be useful if the value was obtained using raw_value_mut()
.
Source::is_in_repository()
to find out if a source is in the repository.
parse::key
to parse a remote.origin.url
-like key to identify a value
Add File::detect_newline_style()
, which does at it says.
File::frontmatter()
and File::sections_and_postmatter()
.
parse::Event::to_bstr_lossy()
to get a glimpse at event content.
File::append()
can append one file to another rather losslessly. The loss happens as we, maybe for the wrong reasons, automatically insert newlines where needed which can only be done while we still know the file boundaries.
file::Section::meta()
to access a section's metadata.
File::sections()
to obtain an iterator over all sections, in order.
place spaces around key = value
pairs, or whatever is used in the source configuration.
proper escaping of value bytes to allow round-tripping after mutation
whitespace in newly pushed keys is derived from first section value. That way, newly added key-value pairs look like they should assuming all keys have the same indentation as the first key in the section.
If there is no key, then the default whitespace will be double-tabs like what's common in git.
File::from_str()
implementation, to support let config: File = "[core]".parse()?
whitespace in mutable sections can be finely controlled, and is derived from existing sections
parse::Header::new(…)
with sub-section name validation
Add parse::(Event|section::Header|Comment)::write_to(…)
. Now it's possible to serialize these types in a streaming fashion and without arbitrarily enforcing UTF-8 on it
serde1
feature to add limited serde support
maintain insertion order of includes on per-section basis at least. Note that git inserts values right after the include directive, ‘splitting’ the section, but we don't do that and insert new values after the section. Probably no issue in practice while keeping our implementation simple.
maintain newline format depending on what‘s present or use platform default. Previously implicit newlines when adding new sections or keys to sections was always \n
which isn’t correct on windows.
Now the newline style is detected and used according to what‘s present, or in the lack of content, defaults to what’s correct for the platform.
validate incoming configuration keys when interpreting environment variables.
Boolean
can use numbers to indicate true or false, drops support for one
and zero
.
file::MutableSection::remove()
now actually removes keys and values.
file::MutableMultiValue
escapes input values and maintains key separator specific whitespace.
value normalization (via value::normalize()
handles escape sequences. The latter ones are \n
, \t
and \b
which are the only supported ones in values of gix-config files.
stable sort order for File::sections_by_name_with_header()
count newlines (for error display) in multi-line values as well
auto-normalize string values to support quote removal in case of strings. Related to https://github.com/starship/starship/pull/3883 .
with
filter` support. add File::resolve_includes()
and move its error type to file::includes
.
add File::from_bytes_owned()
and remove File::from_path_with_buf()
remove File::from_env_paths()
. It's replaced by its more comfortable new_globals()
.
untangle file::init::…
Option
and Error
types. This moves types to where they belong which is more specific instead of having a catch-all Error
and Options
type.
rename parse::Comment::(comment_tag|comment)
to ::tag|text
and parse::Section::section_header
to ::header
.
Associate file::Metadata
with each File
. This is the first step towards knowing more about the source of each value to filter them based on some properties.
This breaks various methods handling the instantiation of configuration files as file::Metadata
typically has to be provided by the caller now or be associated with each path to read configuration from.
rename file::SectionBody
to file::section::Body
.
Remove File::sections_by_name_with_header()
as ::sections_by_name()
now returns entire sections.
create resolve_includes
options to make space for more options when loading paths.
rename path::Options
into path::Context
. It‘s not an option if it’s required context to perform a certain operation.
All accessors in File
are now using impl AsRef<str>
where possible for added comfort.
Much more comfortable API file::*Mut
types thanks to impl Into/AsRef
.
Rename Mutable*
into $1Mut
for consistency.
conform APIs of file::MutableValue
and file::MutableMultiValue
. There are more renames and removals than worth mentioning here given the current adoption of the crate.
rename file::MutableSection::set_leading_space()
to set_leading_whitespace()
. The corresponding getter was renamed as well to leading_whitespace()
.
Enforce parse::section::Header::new()
by making its fields private.
Add File::write_to()
and File::to_bstring()
; remove some TryFrom
impls. Now File
can be serialized in a streaming fashion and without the possibility for UTF8 conversion issues.
Note that Display
is still implemented with the usual caveats.
remove Integer::to_bstring()
as well as some TryFrom
impls. Note that it can still display itself like before via std::fmt::Display
.
remove Boolean::to_bstring()
along with a few From
impls. These were superfluous and aren't useful in practice. Note that serialization is still implemented via Display
.
allocation free File::sections_by_name()
and File::sections_by_name_with_header()
.
Path::interpolate()
now takes path::interpolate::Options
instead of three parameters.
remove String
type in favor of referring to the File::string()
method. The wrapper had no effect whatsoever except for adding complexity.
Simplify Boolean
to be a wrapper around bool
. Previously it tried hard not to degenerate information, making it a complicated type.
However, in practice nobody cares about the exact makeup of the boolean, and there is no need to serialize a boolean faithfully either.
Instead, those who want to set a value just set any value as a string, no need for type safety there, and we take care of escaping values properly on write.
Use bitflags for color::Attribute
instead of Vec
of enums. This is less wasteful and sufficient for git, so it should be sufficient for us, especially since attributes are indeed a set and declaring one twice has no effect.
simplify Color
API. For now we only parse and serialize for display, but more uses are enabled when needed and trivially.
remove parse::Events::from_path
and File::at
The latter has been replaced with File::from_path_with_buf(…)
and is a low-level way to load just a single config file, purposefully uncomfortable as it will not resolve includes.
The initialization API will need some time to stabilize.
Slim down API surface of parse::Events
. It's more of a ‘dumb’ structure now than before, merely present to facilitate typical parsing than something special on its own.
remove File::new()
method in favor of File::default()
.
rename parse::event::List
to parse::Events
rename parse::State
to parse::event::List
move value::*
into the crate root, except for Error
and normalize_*()
.
rename value::parse::Error
to value::Error
.
rename value::TrueVariant
to value::boolean::True
rename IntegerSuffix
to integer::Suffix
rename value::Color(Attribute|Value)
to value::color::Attribute
and value::color::Name
.
Turn parse::ParseOrIoError
into parse::state::from_path::Error
rename parse::ParsedComment
into parse::Comment
rename parse::Section*
related types. These are now located in section::*
.
rename parse::Parser
to parse::State
. Furthermore, make State
the entry point for all parsing, removing all free-standing functions that returned a State
.
rename parser
module to parse
rename normalize_cow()
to normalize()
and move all normalize*
functions from values
to the value
module
move Path
from values
to value
module
Move Boolean
and String
from values
into value
module
move values::Integer
into value
module
move Color
to own value
module
remove values::Bytes
- use values::String
instead. Note that these values are always normalized and it's only possible to get a raw values using the raw_value()
API.
Support for lossy
load mode. There is a lot of breaking changes as file::from_paths::Options
now became file::init::Options
, and the same goes for the error type.
add _filter()
versions to most access methods. That way it's possible to filter values by their origin.
Note that the remove_section()
methods now return the entire removed section, not just the body, which yields more information than before including section metadata.
section names are now validated.
filtering support for parse::Events
. That way it's possible to construct Files which are not destined to be written back as they only keep events necessary for value access, greatly reducing allocations.
change mostly internal uses of [u8] to BString/BStr
Path-interpolation makes home-dir
configurable. That way the caller has full control over how the environment is used, which also allows more fine-grained control over which config files can be included.
Simplify specifying keys when mutating config values.
File::rename_section()
with validation of input arguments.
improve normalization; assure no extra copies are made on query. We now return our own content, rather than the originals with their lifetimes, meaning we bind lifetimes of returned values to our own File
instance. This allows them to be referenced more often, and smarter normalization assures we don't copy in the simple cases either.
More tests were added as well. This is breaking as lifetime changes can cause disruptions, and values?_as()
was removed as well as it‘s somewhat duplicate to higher-level APIs and it wasn’t tested at all.
Remove gix-config
test utilities from gix-path
.
File::raw_multi_value()
to File::raw_values()
File::raw_multi_value_mut()
to File::raw_values_mut()
File::multi_value()
to File::values()
. The latter is better in line with string()/strings()
realpath()
easier to use by introducing realpath_opt()
. That way there is consistency about how many symlinks to follow.File::len()
-> File::num_values()
The same is true for Section::len()
which now is Section::num_values()
.std::env::var_os()
to avoid potential decode errorsGitConfig::from_paths(<paths>, …)
accepts more inputs <paths>
is more flexible and is easier to use. GitConfig::path()
for direct access to paths. Very similar to string()
, but as path, whose query can never fail.
add support for android Do not interpolate ~user/
on Android (Termux). There is no meaning of it. It is single user system.
support for try_value()
, boolean()
and string()
access. Support for a convenient way of knowing if a value does or doesn't exist via
try_value()`, which can only fail if the conversion fails.
Lastly, string()
is a special case which doesn't fail as there is no conversion, and boolean()
allows to obtain a plain boolean value if it was a valid boolean representation.
new hierarchical errors for value lookup
GitConfig::integers()
Get multiple fully validated integer values, with their suffix interpreted and checked for overflow.
add GitConfig::integer()
A way to quickly obtain a valid integer with suffixes resolved and overflow checked.
GitConfig::strings()
for multi-value strings.
remove values::*Error
in favor of value::parse::Error
. This makes it easier to work with errors in practice, we are either interested in the value that failed to parse to try something else or want a nice user message.
Having one decode error type facilitates that.
switch from quickerror to thiserror. This allows for generic types for sources of errors and allows to workaround a limitation with associated type constraints in the MSRV of 1.54.
Using thiserror makes this work and brings the crate more closely to the rest of the gitoxide crates (which now prefer thiserror over quickerror).
remove all get_
prefixes from methods That way the API is more idiomatic and fits better into the existing gitoxide
crates.
use lookup::Error
and lookup::existing::Error
Use the newly introduced structured error to replace the ‘catch-all’ GitConfigError
while getting closer to naming conventions in other gitoxide
crates.
GitConfig::from_paths(…, <option>)
is now owned. The type is Copy
, so no need to pass it by reference.
values::String
data type which makes it easier to obtain string values to work with as binary string.gix_config::values::Path
for a typesafe git path Add a Path
type to the gix_config::values
which can be interpolated according to gits own path interpolation rules.include.path
when reading configuration filesgix_config::values::Value
; use Bytes
in its place.subsection iteration.
introduce method sections_by_name_with_header
to allow iterating over tuples of section header and section body.
A maintenance release.
A maintenance release triggered by changes to gix-pack and changelog rewrites.
This is a maintenance release without functional changes.
GitConfig
:is_empty
len
from_env
open
len
from_env
open
parse_from_path
now accepts a AsRef<Path>
instead of a &Path
.parse_from_path
now returns an ParserOrIoError<'static>
instead, from ParserFromIoError
Include benches in crate to allow publishing to work
remove clippy-cargo lint until there are no warnings Please feel free to re-add once all other git-* crates have been adjusted. It's interesting to see how a crate lint spills into the workspace.
Personally I am surprised that the keywords value is supposed to repeat the crate name as it seems redundant.
remove redundant lines from git-ignore file