Repository navigation
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
Open
Wleeaf (wleeaf) wants to merge 1 commit into
Wleeaf (wleeaf) wants to merge 1 commit into
Conversation
…]` 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.
Contributor
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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()inconfig.c, and the git-config documentation: "the subsection name is converted to lower-case and is also compared case sensitively"). Withgit config --get(2.43)File::string()beforeFile::string()aftersection.subsection.keyvNoneSome("v")section.SubSection.keySome("v")NoneSection.SUBSECTION.KEYNoneNoneThe 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.push_section_internal,insert_section_after,set_section_headerandremove_section_by_id.subsection_name()and serialization don't change.lib.rsnow describes this behaviour.legacy_subsection_is_looked_up_in_lower_caseintests/config/file/access/read_only.rschecks the lower-case lookup, the mixed-case lookup and that the header keeps its original case (on[Remote.Origin]). It fails onmainwithleft: None, right: Some("https://example.com").cargo test -p gix-config --features sha1passes, except for two tests that also fail onmainwith 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) andsource::git_config_no_system.cargo clippy -p gix-config --features sha1 --all-targets -- -D warningsandcargo fmt --checkpass.