fix: disable automatic Git maintenance in gix-testtools#2612
Conversation
Eliah Kagan (EliahKagan)
left a comment
There was a problem hiding this comment.
It looks like this fixes the problem that causes all CI runs to fail, as seen in all recent PRs and feature branches--and as would be seen on main, but it's been a couple weeks since the last push. Rerunning the tests does not cause them to pass, but the change here does.
I'm not sure what's causing that problem. I haven't managed to look into it much, and I unfortunately I don't have time to look into it for most of today. I suspect it may relate to changes how Git does geometric repacking, making it so that when unanticipated garbage collection occurs, the result does not match what we've tested. I don't know to what extent, if any, it overlaps with the problem described in this PR as the motivating issue for it.
I only advocate merging this if it is already known to be correct. Because this remains a draft, I don't want to assume that it is ready. However, I mention this now just in case it turns out this is ready and in case it's considered valuable to get CI working in advance of the forthcoming monthly release (#2618).
There was a problem hiding this comment.
Pull request overview
This PR hardens gix-testtools (and its companion test binary) against Git 2.54+ auto-maintenance by forcing command-scope config that disables automatic maintenance/auto-gc for Git processes launched by test helpers, and adds regression tests to ensure this remains in effect.
Changes:
- Introduce and apply command-scope Git config injection (
maintenance.auto=false,gc.auto=0) across multiple process-spawning helpers. - Extend the “isolated git config” used for fixture/script Git invocations to include the maintenance/auto-gc disables.
- Add regression tests covering direct Git execution, bash-launched Git, and the high-level
git()helper.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| tests/tools/src/lib.rs | Adds command-scope config helper and applies it broadly to Git-related process spawning (git discovery, run helpers, daemon, meta generation, etc.). |
| tests/tools/src/main.rs | Applies the same command-scope config to the git-daemon wrapper used by journey tests. |
| tests/tools/src/tests.rs | Adds regression tests asserting maintenance.auto and gc.auto are disabled through key helpers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…it_config_by_environment` utility Disable maintenance.auto and gc.auto through command-scope Git config for gix-testtools process execution, including fixture scripts, helper-launched Git, cargo example builds, git-daemon wrappers, and shell helpers. Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
…ally Previously, it shuffled possible ports which could cause it to retry multiple times. Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>gst
de7be30 to
123cdaf
Compare
|
Eliah Kagan (@EliahKagan) Thanks for the heads-up, I wasn't aware. In these PR it's probably the same issue (and I didn't even notice yet), and I agree this should be part of the next release. Now I just shouldn't forget to rebase the report PR because I plan to release from there directly. |
|
Thanks! I should refine my description of the situation I believe this fixed, by saying that it was occasionally possible for the test suite to pass after the problem started yet before this fix, but I have only managed to produce one known example of it passing. So in a sense it was a flake, but it was more of an anti-flake--the test job passing was the rare thing. I expect that the fix here will much reduce or eliminate the problems, other than those that are due to problems with GHA's own infrastructure (which have been going on for a bit longer than the ones that appear correlated with the new Git version). |
If feasible, I think it would be helpful to Windows users if #2607 can also come in before the monthly gitoxide release. I think everything there is in good shape, I've rebased it, and due to the fix in this PR, I expect all tests to pass. I've enabled auto-merge in #2607. Edit: #2607 has merged. |
Tasks
Created by Codex on behalf of Byron. Byron will review before this is ready to merge.
Reported issue
Summary
gix-testtoolsto setmaintenance.auto=falseandgc.auto=0for processes the crate executes.git(),run_git(),invoke_bash(), git-daemon wrappers, Git version discovery, metadata generation, cargo example builds, and shell helpers.git()helper.Git reference
Git's
prepare_auto_maintenance()skips automatic maintenance whenmaintenance.auto=false; Git's maintenance documentation also states thatgit maintenance registerdisables foreground maintenance by settingmaintenance.auto=false. The fix also setsgc.auto=0to cover oldergit gc --autopaths.Validation
cargo test -p gix-testtools auto_maintenancecargo test -p gix-testtoolscargo clippy -p gix-testtools --all-targetscargo test -p gix-testtools auto_maintenance --no-default-featuresReview
codex review --commit de7be303f3f6b9edc5d759f3ae7b39e89ed162e1found no actionable issues.