1704 lines · 148.4 KB · Markdown
RawDownload

Changelog

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.

0.7.0 (2022-08-24)

Chore

  • uniformize deny attributes

New Features

  • 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

Bug Fixes

  • 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.

Changed (BREAKING)

  • Add File::set_raw_value() to unconditionally set single values, and make the value itself easier to provide.

New Features (BREAKING)

  • 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.

Other (BREAKING)

  • 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.

Commit Statistics

  • 19 commits contributed to the release over the course of 3 calendar days.
  • 6 days passed between releases.
  • 11 commits where understood as conventional.
  • 1 unique issue was worked on: #450

Thanks Clippy

Clippy helped 1 time to make code idiomatic.

Commit Details

view details
  • #450
    • Properly handle boolean values such that a is true but a= is false. (08c50a4)
    • fix config tests on windows (7a871c2)
    • Keep track of a severe limitation and prepare tests for fixing it. (7c58516)
    • file::SectionMut::push() now supports values without key-value separator. (b6cd6ac)
    • refactor (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)
    • Add 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)
  • Uncategorized
    • Release git-path v0.4.1 (5e82346)
    • Merge branch 'example-write-blob' (afedd7f)
    • Merge pull request #494 from ultrasaurus/patch-1 (86fe22c)
    • thanks clippy (2770431)
    • Merge branch 'main' into remote-ls-refs (95f2f4f)
    • Merge branch 'example-new-repo' (946dd3a)
    • use docsrs feature in code to show what is feature-gated automatically on docs.rs (b1c40b0)
    • uniformize deny attributes (f7f136d)
    • pass --cfg docsrs when compiling for https://docs.rs (5176771)

0.6.1 (2022-08-17)

A maintenance release without user facing changes.

Commit Statistics

  • 10 commits contributed to the release over the course of 26 calendar days.
  • 26 days passed between releases.
  • 0 commits where understood as conventional.
  • 1 unique issue was worked on: #482

Thanks Clippy

Clippy helped 1 time to make code idiomatic.

Commit Details

view details
  • #482
  • Uncategorized
    • Release git-date v0.0.3, git-actor v0.11.1, git-attributes v0.3.1, git-tempfile v2.0.3, git-object v0.20.1, git-ref v0.15.1, git-config v0.6.1, git-diff v0.17.1, git-discover v0.4.0, git-bitmap v0.1.1, git-index v0.4.1, git-mailmap v0.3.1, git-traverse v0.16.1, git-pack v0.21.1, git-odb v0.31.1, git-packetline v0.12.6, git-url v0.7.1, git-transport v0.19.1, git-protocol v0.18.1, git-revision v0.4.0, git-worktree v0.4.1, git-repository v0.21.0, safety bump 5 crates (c96473d)
    • prepare changelogs prior to reelase (c06ae1c)
    • Release git-hash v0.9.7, git-features v0.22.1 (232784a)
    • Merge branch 'format_git_date_time' (99e12be)
    • thanks clippy (4bd747c)
    • commit strange changes to be able to do anything. (237b21d)
    • commit strange crlf-file that makes everything impossible (1dd9f9a)
    • make fmt (47724c0)
    • Fix typos (e9fcb70)

0.6.0 (2022-07-22)

New Features

  • 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

Bug Fixes

  • 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 .

Other

  • :Events::from_bytes()withfilter` support.

Changed (BREAKING)

  • 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.

New Features (BREAKING)

  • 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.

Bug Fixes (BREAKING)

  • 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.

Other (BREAKING)

  • 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()

Commit Statistics

  • 316 commits contributed to the release over the course of 33 calendar days.
  • 39 days passed between releases.
  • 93 commits where understood as conventional.
  • 1 unique issue was worked on: #331

Thanks Clippy

Clippy helped 19 times to make code idiomatic.

Commit Details

view details
  • #331
    • final documentation review + adjustments prior to release candidate (06b86e0)
    • refactor (4dc6594)
    • exclude particular assertion which fails on the linux CI. (5e0f889)
    • first sketch of using configuration and environment variables for author/committer (330d0a1)
    • remove Permissions as there is no need for that here. (1954ef0)
    • following includes is now non-fatal by default (1bc96bf)
    • Allow to skip non-existing input paths without error (989603e)
    • File::from_git_dir() as comfortable way to instantiate most complete git configuration. (f9ce1b5)
    • Add a way to load multiple configuration files without allocating a read buffer (acb4520)
    • refactor (ec21e95)
    • move Env test utility into git-testtools (bd3f4d0)
    • refactor (b073e29)
    • another failing tests that can't be fixed without a refactor (e4d8fd7)
    • an attempt to hack newline handling into place for windows newlines (dac1463)
    • Serialize lossily-read configuration files correctly anyway. (cfda0c3)
    • multi-path include test (3d89a46)
    • refactor (8a7fb15)
    • fix windows tests (fbcf40e)
    • finally proper whitespace handling in all the right places for perfect roundtripping to/from string (97e5ede)
    • serializations maintains some invariants about whitespace where possible. (ee10dd5)
    • refactor (9c248ee)
    • File now compares actual content, ignoring whitespace and comments. (14a68a6)
    • maintain insertion order of includes on per-section basis at least. (6c1588f)
    • allow insertion of sections while preserving order (f5580a3)
    • a test showing that include ordering isn't correct compared to the including config. (4e47df5)
    • add File::resolve_includes() and move its error type to file::includes. (17c83d5)
    • add File::from_bytes_owned() and remove File::from_path_with_buf() (5221676)
    • make it necessary to deal with the possibility of no-input in from_paths_metadata() . (612645f)
    • Don't fail on empty input on the comfort level (61ecaca)
    • File::new_environment_overrides() to easily instantiate overrides from the environment. (7dadfd8)
    • prepare for supporting comfortable version of environment overrides (45c964a)
    • remove File::from_env_paths(). (98d45c2)
    • File::new_globals() can instantiate non-local configuration with zero-configuration. (146eeb0)
    • Classify 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)
    • maintain newline format depending on what's present or use platform default. (f7bd2ca)
    • prepare for passing through newline (3c06f88)
    • Add File::detect_newline_style(), which does at it says. (26147a7)
    • fix docs (78e85d9)
    • a test for lossy File parsing (5e8127b)
    • 'lossy' is now inherited by includes processing (88c6b18)
    • untangle file::init::… Option and Error types. (230a523)
    • Support for lossy load mode. (d003c0f)
    • :Events::from_bytes()withfilter support. ([32d5b3c`](https://github.com/Byron/gitoxide/commit/32d5b3c695d868ba93755123a25b276bfbe55e0a))
    • try to fix attributes, once more (a50a396)
    • File::frontmatter() and File::sections_and_postmatter(). (0ad1c9a)
    • add _filter() versions to most access methods. (1ea26d8)
    • even better handling of newlines (50c1753)
    • refactor (df94c67)
    • rename 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)
    • finally fix newline behaviour (c70e135)
    • Be smarter about which newline style to use by guessing it based onprior events (25ed92e)
    • File::append() can append one file to another rather losslessly. (09966a8)
    • A test to validate frontmatter isn't currently handled correctly when appending (4665e87)
    • file::Section::meta() to access a section's metadata. (56ae574)
    • refactor (d60025e)
    • File::sections() to obtain an iterator over all sections, in order. (6f97bf0)
    • Associate file::Metadata with each File. (6f4eea9)
    • rename file::SectionBody to file::section::Body. (b672ed7)
    • Remove File::sections_by_name_with_header() as ::sections_by_name() now returns entire sections. (3bea26d)
    • A way to more easily set interpolation even without following includes. (9aa5acd)
    • create resolve_includes options to make space for more options when loading paths. (41b3e62)
    • rename path::Options into path::Context. (cabc8ef)
    • try to fix attributes, once more (207e483)
    • validate incoming conifguration keys when interpreting envirnoment variables. (0d07ef1)
    • try to fix filter settings, but it doesn't seem to work (9750b7a)
    • sketch new section and metadata (9cb9acb)
    • add 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)
    • All accessors in File are now using impl AsRef<str> where possible for added comfort. (3de0cfd)
    • Much more comfortable API file::*Mut types thanks to impl Into/AsRef. (3d25fe6)
    • Rename Mutable* into $1Mut for consistency. (393b392)
    • file::MutableSection::remove() now actually removes keys and values. (94dde44)
    • many more tests for MutableSection (ac843cb)
    • refactor (701266e)
    • conform APIs of file::MutableValue and file::MutableMultiValue. (0a7391a)
    • file::MutableMultiValue escapes input values and maintains key separator specific whitespace. (048b925)
    • place spaces around key = value pairs, or whatever is used in the source configuration. (5418bc7)
    • avoid extra copies when setting values and escaping them (a7eff01)
    • refactor (15cd1d2)
    • more empty-value tests (511985a)
    • default space is just a single tab, not two ones (7e03b83)
    • proper escaping of value bytes to allow round-tripping after mutation (8118644)
    • refactor (afa736a)
    • a few tests for MutableValue showing that it's too buggy right now (5e6f9d9)
    • rename file::MutableSection::set_leading_space() to set_leading_whitespace(). (83a0922)
    • whitespace in newly pushed keys is derived from first section value. (9f59356)
    • File::from_str() implementation, to support let config: File = "[core]".parse()? (db1f34d)
    • whitespace in mutable sections can be finely controlled, and is derived from existing sections (9157717)
    • refactor (c88eea8)
    • refactor (a0d6caa)
    • auto-compute whitespace for sections, even though it probably needs to be better than that (ee9ac95)
    • validation for Keys and header names (59ec7f7)
    • Simplify specifying keys when mutating config values. (a93a156)
    • File::rename_section() with validation of input arguments. (895ce40)
    • re-add newlines after multi-line values (9a2f597)
    • more header escaping tests (12cf005)
    • Enforce parse::section::Header::new() by making its fields private. (219cf7a)
    • parse::Header::new(…) with sub-section name validation (ae3895c)
    • section names are now validated. (cfd974f)
    • prepare for validation of parse::section::Header (00592f6)
    • basic escaping of subsection names during serialization (00d1a9b)
    • refactor (9fac8e0)
    • new roundtrip test on file level (78bb93c)
    • Add File::write_to() and File::to_bstring(); remove some TryFrom impls. (4f6cd8c)
    • remove Integer::to_bstring() as well as some TryFrom impls. (0e392f8)
    • remove Boolean::to_bstring() along with a few From impls. (b22732a)
    • Add parse::(Event|section::Header|Comment)::write_to(…). (d087f12)
    • fix tests on windows (3d7fc18)
    • value normalization (via value::normalize() handles escape sequences. (f911707)
    • refactor normalization and more tests (cf3bf4a)
    • more escape characters for normalization (b92bd58)
    • review docs of file::mutating (2d5703e)
    • stable sort order for File::sections_by_name_with_header() (44dfec0)
    • review file::raw module (6acf4a4)
    • don't over-normalize in comfort layer - all values are normalized now (b979a3b)
    • docs for comfort level File API (eafc6ce)
    • review and refactor 'File::value' module (7aa8a0b)
    • allocation free File::sections_by_name() and File::sections_by_name_with_header(). (65c520c)
    • refactor (2abffd6)
    • refactor (539c2f6)
    • refactor (f1668e9)

Lines 1–500 of 1704.