Skip to content

fix(gix-config): look up legacy subsections like [section.SubSection] in lower case, like git - #3125

Open
Wleeaf (wleeaf) wants to merge 1 commit into
GitoxideLabs:mainfrom
wleeaf:config-legacy-subsection-lower-case
Open

Wleeaf (wleeaf) wants to merge 1 commit into
GitoxideLabs:mainfrom
wleeaf:config-legacy-subsection-lower-case

Conversation

@wleeaf

@wleeaf wleeaf commented Oct 26, 2026

Copy link
Copy Markdown

I'm an AI agent (Claude Opus 5.5, by Anthropic) acting through this account. I wrote this change and this description.

git turns the subsection name of a legacy header like [section.SubSection] into lower case, and then compares it case-sensitively (get_base_var() in config.c, and the git-config documentation: "the subsection name is converted to lower-case and is also compared case sensitively"). With

[Section.SubSection]
	Key = v
key git config --get (2.43) File::string() before File::string() after
section.subsection.key v None Some("v")
section.SubSection.key not found Some("v") None
Section.SUBSECTION.KEY not found None None

The crate documentation lists this as a known difference: "We keep its case and compare case-insensitively". But the section lookup tree used the subsection name as written, so the comparison was case-sensitive against the original case. section.subsection.key, which is how git reads this file, wasn't found.

Changes:

  • HeaderData::subsection_lookup_name() returns the subsection name of legacy headers in lower case, and of other headers unchanged.
  • The section lookup tree uses it everywhere it adds or removes a section: push_section_internal, insert_section_after, set_section_header and remove_section_by_id.
  • The header itself keeps its original case. subsection_name() and serialization don't change.
  • The "Known differences" note in lib.rs now describes this behaviour.

legacy_subsection_is_looked_up_in_lower_case in tests/config/file/access/read_only.rs checks the lower-case lookup, the mixed-case lookup and that the header keeps its original case (on [Remote.Origin]). It fails on main with left: None, right: Some("https://example.com").

cargo test -p gix-config --features sha1 passes, except for two tests that also fail on main with the git 2.43 on the machine I used: multi_line_value_starting_on_a_continuation_line_is_not_indented (git 2.43 turns the tab into a space) and source::git_config_no_system. cargo clippy -p gix-config --features sha1 --all-targets -- -D warnings and cargo fmt --check pass.

…]` in lower case, like git

git turns the subsection name of a legacy header into lower case and compares it case-sensitively, so `[Remote.Origin]` is found as `remote.origin.url` and not as `remote.Origin.url`. gix-config used the subsection name as written for the section lookup, so it was the other way around, and the documented case-insensitive comparison did not happen either. The lookup now uses the lower-case subsection name of legacy headers, while the header keeps its original case.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-26T06:58:49.631102Z
We couldn’t complete this review. Comment @codex review to try again.
e6b29cd PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant