gix config refresh and writing - #2929
Open
Sebastian Thiel (Byron) wants to merge 5 commits into
Open
Conversation
Contributor
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Sebastian Thiel (Byron)
force-pushed
the
config-refresh
branch
from
August 19, 2026 02:27
f6ae846 to
9bacd89
Compare
Sebastian Thiel (Byron)
force-pushed
the
config-refresh
branch
5 times, most recently
from
August 27, 2026 12:10
b1e8570 to
cbdb3b0
Compare
Add opt-in final-symlink resolution for callers that need Git default lockfile behavior while retaining the existing no-follow API for loose references. Resolve again before each retry and retain the target whose lock was actually acquired. Append the lock suffix directly to OsString values so non-UTF-8 resource names remain byte-exact. Retain each original resource path instead of reconstructing it from the lock filename, avoiding panics for dotfile locks. Allow symlink-aware callers to adjust lock permissions after the process umask has been applied, so shared-repository modes can grant the intended access.
Add Repository::config_file_mut() as a transaction over one physical configuration file. It acquires a symlink-aware lock before reading, parses without expanding includes, preserves formatting and existing permissions, and resolves relative paths against the opening CWD. Lock acquisition honors the discoverable core.configLockTimeout key with Git-compatible parsing and a 1000 ms default. New files also honor core.sharedRepository after the process umask, including named, boolean, compatibility, and explicit octal modes. Committing only writes the file atomically. Repository state changes through an explicit full reload, which retains normal Git-compatible validation and rebuilds include- and bootstrap-dependent state without a second partial-refresh path.
Sebastian Thiel (Byron)
force-pushed
the
config-refresh
branch
from
August 27, 2026 12:44
cbdb3b0 to
e8b392f
Compare
The tempfile crate normalizes a temporary file attributes before persistence, which drops permissions copied from the resource being updated. Windows also refuses to replace a read-only destination directly, causing config commits either to fail or to become writable. Persist with MoveFileExW on Windows after removing only the temporary attribute and temporarily clearing a read-only destination. Restore both paths attributes after failed attempts so the existing retry and recovery guarantees remain intact. Cover direct tempfile replacement and repository config mutation with Windows regression tests.
… Windows regression tests. Assisted-by: GPT 5.6 Co-authored-by: GPT 5.6 <codex@openai.com>
Windows canonicalization can produce verbatim paths with a `\\?\` prefix while included configuration metadata uses an ordinary drive path. Comparing those representations directly prevents an explicitly safe config file from being promoted to full trust, including after repository reloads. Canonicalize both the path under test and configured safe-directory paths through the filesystem before exact or wildcard comparison. Retain the existing lexical realpath fallback for missing paths.
Sebastian Thiel (Byron)
force-pushed
the
config-refresh
branch
from
August 27, 2026 13:40
271020b to
b396780
Compare
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.
Tasks
This section is for Byron only. Models continuing this PR must not add, remove, check, uncheck, rename, or reorder checkboxes here.
Everything below this line was generated by Codex GPT-5.
Created by Codex on behalf of Byron. Byron will review before this is ready to merge.
Summary
Repository::config()andconfig_mut()accessors that refresh changed configuration files while leaving snapshot-only access free of freshness I/Oopen::Options::config_overrides()SnapshotMut::commit_to_file()to atomically write one exact file designation with lock-first mtime validation, permission preservation, and deleted-file recreationCommits
4c759f742e— refresh repository configuration on access, including the platform-specific size guard9bacd89ae1— write mutable configuration snapshots to diskGit baseline
Git's
config.cclears and reloads repository configuration with includes, and its file mutation path locks<path>.lock, preserves the file mode, then commits by atomic rename. This change adapts those behaviors to long-livedgix::Repositorysnapshots and adds the requested mtime stale-write guard.Validation
GIX_TEST_IGNORE_ARCHIVES=1 cargo test -p gix --test gix repository::config::config_snapshotGIX_TEST_IGNORE_ARCHIVES=1 cargo test -p gix --test gix repository::config::config_snapshot::commit_to_fileGIX_TEST_IGNORE_ARCHIVES=1 cargo test -p gix --test gix repository::size_in_memory -- --exactGIX_TEST_IGNORE_ARCHIVES=1 cargo test -p gix --test gix --features async-network-client repository::size_in_memory -- --exactcargo clippy -p gix --all-targets -- -D warningscargo deny --workspace --all-features check bans licenses sourcesenv GIX_TEST_IGNORE_ARCHIVES=1 just ci-testThe required one-time
codex review --commitinvocation was attempted for each original pre-squash commit, but the review service rejected all four because the account usage limit was exhausted. Independent agent audits were completed for both feature commits and the Windows CI fix.Reported issue
Original report
Write-back follow-up
Clarification