github GitoxideLabs/gitoxide gix-config-v0.59.0
gix-config v0.59.0

4 hours ago

New Features

  • add parse::format to normalize git-config whitespace.
    Adds gix_config::parse::format::normalize(input, &Options), which re-emits a
    single config file with sanitized whitespace without resolving includes. Values,
    comments and section headers are preserved verbatim; only insignificant
    whitespace, the = separator and newlines are rewritten.

    Options controls indentation (two spaces by default; tabs or none also
    available), spacing around =, the newline sequence (detect/LF/CRLF), the
    trailing newline, and optional blank-line collapsing.

    This is the library portion; the CLI will follow separately.

  • return config values with their containing sections via File::*_with_sections() methods.
    That way it's easier to know where a value is coming from.
    Also streamline arguments and available methods for concistency.

  • add SectionMut::rename() for precise single-section renames.
    This is important now that File::rename_section*() renames all matching
    sections.

Bug Fixes

  • rename all matching sections in File::rename_section(), instead of just the last matching one.
    This is the correct behaviour and is what Git uses, even though it could break previous users in a setting
    where there are global configurations, like remote sections.

Changed (BREAKING)

  • validate config value names internally and use AsBStrOpt for value pushes.
    This makes using the APIs much more convenient.

Chore (BREAKING)

  • adapt to changes in gix-config
    Marked as breaking explicitly to as we know paramter types were
    changed to use convenience traits.

New Features (BREAKING)

  • make parsed configuration files lifetime-free
    Store parsed configuration data in a self-contained backing buffer, with
    event payloads represented as compact spans into it. This removes the
    input lifetime from File and Events, making parsed configurations
    easier to return, store, move, and combine.

    Expose data through lightweight EventRef, SectionRef, HeaderRef,
    and BodyRef views. This retains efficient borrowed access while keeping
    ownership details out of the primary API.

    • Unify parsing under Events::from_bytes() and remove
      from_bytes_owned().
    • Add Events::iter(), frontmatter(), and sections() for
      non-consuming traversal.
    • Return owned BString values from lookups, avoiding Cow handling.
    • Simplify optional typed lookups from Option<Result<T, E>> to
      Result<Option<T>, E>.
    • Accept common string and byte-string inputs through AsBStr and
      IntoBStringOpt.
    • Allow concise calls such as new_section("remote", "origin") without
      constructing Option<Cow<...>>.
    • Reduce mutable value and section handles to the lifetime of their
      active file borrow.

    Introduce explicit section ownership: Section is self-contained and
    can be removed, edited, and inserted into another file, while
    SectionRef and SectionMut provide borrowed access.

    Preserve original subsection spelling for serialization while retaining
    decoded names for lookup. Configuration equality now also compares
    section and value names case-insensitively, matching Git semantics.

    Add benchmarks covering section, value, subsection, and multi-value
    lookups across configurations of varying sizes.

Bug Fixes (BREAKING)

  • simplify gix-config section lookup acceleration
    breaking change for safety, as parameter types were changed.

    --- agent

    Replace the terminal/non-terminal enum vector with a direct boxed lookup
    record, use a Vec for section order, and centralize ordered insertion and
    removal. Empty lookup buckets are removed instead of becoming special cases.

    This removes 137 production lines, including 108 lines from the lookup
    utility, while adding targeted ordering and cleanup coverage.

    Back-to-back lookup benchmarks against the previous revision show:

    • section-name lookup: +0.4% at 10 and 100 sections, +4.2% at 1,000
    • subsection lookup: 5.7% to 9.1% faster
    • all-sections lookup: between 5.5% faster and 4.7% slower
    • isolated complete-value lookup: +0.8%, with no significant change

    Thus all lookup groups remain within the 5% parity target, with subsection
    lookup becoming consistently faster.

Commit Statistics

  • 21 commits contributed to the release.
  • 31 days passed between releases.
  • 8 commits were understood as conventional.
  • 1 unique issue was worked on: #2594

Thanks Clippy

Clippy helped 1 time to make code idiomatic.

Commit Details

view details
  • #2594
    • Add parse::format to normalize git-config whitespace. (d125a59)
  • Uncategorized
    • Update changelogs prior to release (cb6ec7d)
    • Release gix-trace v0.1.21, gix-validate v0.11.3, gix-path v0.12.3, gix-utils v0.3.5, gix-config-value v0.19.0, gix-prompt v0.16.0, gix-sec v0.14.2, gix-url v0.37.0, gix-credentials v0.39.0, safety bump 18 crates (f0ec710)
    • Merge pull request #2636 from ameyypawar/gix-config-formatter (cfd3899)
    • Review (1825e85)
    • Merge pull request #2725 from GitoxideLabs/gix-config-improvements (5982dfe)
    • Adapt to changes in gix-config (6aa934a)
    • Return config values with their containing sections via File::*_with_sections() methods. (ec2895f)
    • Validate config value names internally and use AsBStrOpt for value pushes. (0887485)
    • Add SectionMut::rename() for precise single-section renames. (1ce5b56)
    • Rename all matching sections in File::rename_section(), instead of just the last matching one. (b92d0ff)
    • Simplify gix-config section lookup acceleration (784323a)
    • Merge pull request #2722 from GitoxideLabs/reasons (c16b5a1)
    • Replace lint allowances with expectations (43ff87a)
    • Merge pull request #2667 from GitoxideLabs/lifetime-free-config-parser (55b5158)
    • Make parsed configuration files lifetime-free (0e3b35b)
    • Merge pull request #2714 from GitoxideLabs/fix-credentials-parsing (cf3053a)
    • Release gix-path v0.12.2, gix-error v0.2.5, gix-utils v0.3.4, gix-date v0.15.6, gix-url v0.36.2, gix-credentials v0.38.2 (27aec47)
    • Merge pull request #2702 from ameyypawar/fix/2694-exn-source-chain (e9c973d)
    • Thanks clippy (d533f0c)
    • Merge pull request #2646 from GitoxideLabs/report (1b1541e)

Don't miss a new gitoxide release

NewReleases is sending notifications on new releases.