From b58ef1f30e3b6f157e75de339bdfddcea571e399 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Tue, 10 Dec 2024 09:28:39 -0500 Subject: [PATCH] Refine complex_graph `regex_matches` partial suppressions This updates the comment about #1622, including by adding links to Git mailing list posts by Aarni Koskela, who discovered the bug that turns out to be the cause of this, and Patrick Steinhardt, who analyzed the bug and wrote a fix (currently in testing), as well as https://github.com/GitoxideLabs/gitoxide/issues/1622#issuecomment-2529580735, which summarizes that and reports on its connection to #1622. This also narrows partial suppression of the failing test code (which consists of conditionally using `parse_spec_no_baseline` instead of `parse_spec` in some assertions) so that it is only done if Git is at one of the versions that is known to be affected. If any future Git versions are affected, such as by the currently cooking patch not being merged as soon as I expect, then this could potentially fail on CI again. But that is something we would probably want to find out about. --- .../gix/revision/spec/from_bytes/regex.rs | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/gix/tests/gix/revision/spec/from_bytes/regex.rs b/gix/tests/gix/revision/spec/from_bytes/regex.rs index cc15e0c895f..c85c4928e85 100644 --- a/gix/tests/gix/revision/spec/from_bytes/regex.rs +++ b/gix/tests/gix/revision/spec/from_bytes/regex.rs @@ -58,6 +58,7 @@ mod with_known_revision { mod find_youngest_matching_commit { use gix::revision::Spec; + use std::borrow::Borrow; use super::*; use crate::revision::spec::from_bytes::parse_spec; @@ -95,11 +96,19 @@ mod find_youngest_matching_commit { fn regex_matches() { let repo = repo("complex_graph").unwrap(); - // On the full linux CI `test` workflow, archived baseline aren't used - instead fixtures will be re-evaluated. - // As of Git 2.47, its behaviour changed which makes the following assertion fail. - // We decided to just ignore it until it's clear that this isn't a bug - obviously the traversal order changed. - let is_in_test_ci_workflow = is_ci::cached() && std::env::var_os("GIX_TEST_IGNORE_ARCHIVES").is_some(); - if is_in_test_ci_workflow { + // The full Linux CI `test` job regenerates baselines instead of taking them from archives. + // In Git 2.47.0 (and 2.47.1), the traversal order differs, so some `parse_spec` assertions + // fail. This is a Git bug with a forthcoming fix. For now, we use `parse_spec_no_baseline` + // for them when tests are run that way with known-affected Git versions. For details, see: + // + // - https://lore.kernel.org/git/Z1LJSADiStlFicTL@pks.im/T/ + // - https://lore.kernel.org/git/Z1LtS-8f8WZyobz3@pks.im/T/ + // - https://github.com/GitoxideLabs/gitoxide/issues/1622#issuecomment-2529580735 + let skip_some_baselines = is_ci::cached() + && std::env::var_os("GIX_TEST_IGNORE_ARCHIVES").is_some() + && ((2, 47, 0)..(2, 47, 2)).contains(gix_testtools::GIT_VERSION.borrow()); + + if skip_some_baselines { assert_eq!( parse_spec_no_baseline(":/mes.age", &repo).unwrap(), Spec::from_id(hex_to_id("ef80b4b77b167f326351c93284dc0eb00dd54ff4").attach(&repo)) @@ -116,7 +125,7 @@ mod find_youngest_matching_commit { "None of 10 commits reached from all references matched regex \"not there\"" ); - if is_in_test_ci_workflow { + if skip_some_baselines { assert_eq!( parse_spec_no_baseline(":/!-message", &repo).unwrap(), Spec::from_id(hex_to_id("55e825ebe8fd2ff78cad3826afb696b96b576a7e").attach(&repo))