From c9490300b116cf468cca82d87c65c9190e9a6696 Mon Sep 17 00:00:00 2001
From: Sebastian Thiel <sebastian.thiel@icloud.com>
Date: Sat, 19 Oct 2024 07:46:48 +0200
Subject: [PATCH 1/2] fix CI for now by excluding the failing assertion from
 running.

On the CI linux 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.

----

This temporarily suppresses baseline comparisons for two patterns
where the baseline checks fail if the `complex_graph` fixture
script was run in Git 2.47.0.

For now, they are unconditionally suppressed, regardless of the Git
version or whether generated archives are used. This change is
specific to the `find_youngest_matching_commit::regex_matches`
test.

This works around, but does not fix, issue #1622. The affected test
is still run, but the two directly affected baseline checks are
skipped.

Co-authored-by: Eliah Kagan <degeneracypressure@gmail.com>
---
 .../gix/revision/spec/from_bytes/regex.rs     | 34 ++++++++++++++-----
 1 file changed, 26 insertions(+), 8 deletions(-)

diff --git a/gix/tests/gix/revision/spec/from_bytes/regex.rs b/gix/tests/gix/revision/spec/from_bytes/regex.rs
index fe7b4a5446d..d12039a1d04 100644
--- a/gix/tests/gix/revision/spec/from_bytes/regex.rs
+++ b/gix/tests/gix/revision/spec/from_bytes/regex.rs
@@ -95,20 +95,38 @@ mod find_youngest_matching_commit {
     fn regex_matches() {
         let repo = repo("complex_graph").unwrap();
 
-        assert_eq!(
-            parse_spec(":/mes.age", &repo).unwrap(),
-            Spec::from_id(hex_to_id("ef80b4b77b167f326351c93284dc0eb00dd54ff4").attach(&repo))
-        );
+        // On the CI linux 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 {
+            assert_eq!(
+                parse_spec_no_baseline(":/mes.age", &repo).unwrap(),
+                Spec::from_id(hex_to_id("ef80b4b77b167f326351c93284dc0eb00dd54ff4").attach(&repo))
+            );
+        } else {
+            assert_eq!(
+                parse_spec(":/mes.age", &repo).unwrap(),
+                Spec::from_id(hex_to_id("ef80b4b77b167f326351c93284dc0eb00dd54ff4").attach(&repo))
+            );
+        }
 
         assert_eq!(
             parse_spec(":/not there", &repo).unwrap_err().to_string(),
             "None of 10 commits reached from all references matched regex \"not there\""
         );
 
-        assert_eq!(
-            parse_spec(":/!-message", &repo).unwrap(),
-            Spec::from_id(hex_to_id("55e825ebe8fd2ff78cad3826afb696b96b576a7e").attach(&repo))
-        );
+        if is_in_test_ci_workflow {
+            assert_eq!(
+                parse_spec_no_baseline(":/!-message", &repo).unwrap(),
+                Spec::from_id(hex_to_id("55e825ebe8fd2ff78cad3826afb696b96b576a7e").attach(&repo))
+            );
+        } else {
+            assert_eq!(
+                parse_spec(":/!-message", &repo).unwrap(),
+                Spec::from_id(hex_to_id("55e825ebe8fd2ff78cad3826afb696b96b576a7e").attach(&repo))
+            );
+        }
 
         assert_eq!(
             parse_spec("@^{/!-B}", &repo).unwrap(),

From e51fcd0772e087b5692f632ff8785b43d299a3f6 Mon Sep 17 00:00:00 2001
From: Sebastian Thiel <sebastian.thiel@icloud.com>
Date: Sat, 19 Oct 2024 08:40:24 +0200
Subject: [PATCH 2/2] Improve wording of comment in test

Co-authored-by: Eliah Kagan <degeneracypressure@gmail.com>
---
 gix/tests/gix/revision/spec/from_bytes/regex.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gix/tests/gix/revision/spec/from_bytes/regex.rs b/gix/tests/gix/revision/spec/from_bytes/regex.rs
index d12039a1d04..cc15e0c895f 100644
--- a/gix/tests/gix/revision/spec/from_bytes/regex.rs
+++ b/gix/tests/gix/revision/spec/from_bytes/regex.rs
@@ -95,7 +95,7 @@ mod find_youngest_matching_commit {
     fn regex_matches() {
         let repo = repo("complex_graph").unwrap();
 
-        // On the CI linux workflow, archived baseline aren't used - instead fixtures will be re-evaluated.
+        // 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();