From a97b985f0a96f34dd4db46389629527ac615c3dc Mon Sep 17 00:00:00 2001 From: zengchuang-hw Date: Mon, 23 Nov 2026 00:49:38 +0800 Subject: [PATCH 1/3] Restore submodule fixture bytes after snapshot edits Preserve checkout line endings and verify that restoring the original bytes restores the source snapshot. Agent-assisted-by: Codex (author) Signed-off-by: zengchuang-hw --- tests/test_runtime.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/test_runtime.py b/tests/test_runtime.py index 1b0dca63d..9c536f73d 100644 --- a/tests/test_runtime.py +++ b/tests/test_runtime.py @@ -328,14 +328,18 @@ def test_submodule_local_edit_changes_snapshot_hash(self): # inside a submodule must not share one snapshot hash. superproject = self.make_superproject() vendor = superproject / "sub" / "vendor.py" + original = vendor.read_bytes() # Preserve Git's checkout line endings. + original_snapshot = repository_identity(superproject)["snapshot_hash"] vendor.write_bytes(b"first edit\n") first = repository_identity(superproject)["snapshot_hash"] vendor.write_bytes(b"second edit\n") second = repository_identity(superproject)["snapshot_hash"] self.assertNotEqual(first, second) self.assertTrue(repository_identity(superproject)["dirty"]) - vendor.write_bytes(b"original\n") - self.assertFalse(repository_identity(superproject)["dirty"]) + vendor.write_bytes(original) + restored = repository_identity(superproject) + self.assertFalse(restored["dirty"]) + self.assertEqual(restored["snapshot_hash"], original_snapshot) def test_untracked_nested_repository_is_hashed_not_unavailable(self): # Git reports an untracked nested repository as one directory entry; From 56d0f9caa62ac9dd61e4af928f3457979accc4cf Mon Sep 17 00:00:00 2001 From: zengchuang-hw Date: Mon, 23 Nov 2026 03:00:24 +0800 Subject: [PATCH 2/3] Refresh independent review for the unchanged snapshot regression Keep the source tree unchanged while renewing revision-scoped review records and CI. Agent-assisted-by: Codex (integrator) Signed-off-by: zengchuang-hw From 71003438aa98d6362ef9f24d3d134e383a493520 Mon Sep 17 00:00:00 2001 From: zengchuang-hw Date: Mon, 23 Nov 2026 03:11:56 +0800 Subject: [PATCH 3/3] Exercise snapshot restoration under LF and CRLF Select process-scoped Git settings and verify actual checkout bytes on each host, preserving inherited Git options and all restoration assertions. Agent-assisted-by: Codex (author) Signed-off-by: zengchuang-hw --- tests/test_runtime.py | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/tests/test_runtime.py b/tests/test_runtime.py index 9c536f73d..ae6987ae0 100644 --- a/tests/test_runtime.py +++ b/tests/test_runtime.py @@ -324,22 +324,36 @@ def make_superproject(self): return superproject def test_submodule_local_edit_changes_snapshot_hash(self): + self._check_submodule_edit_restore("true") + + def test_submodule_local_edit_with_lf_checkout_changes_snapshot_hash(self): + self._check_submodule_edit_restore("false") + + def _check_submodule_edit_restore(self, autocrlf): # The parent diff records only "-dirty", so two distinct edits # inside a submodule must not share one snapshot hash. - superproject = self.make_superproject() - vendor = superproject / "sub" / "vendor.py" - original = vendor.read_bytes() # Preserve Git's checkout line endings. - original_snapshot = repository_identity(superproject)["snapshot_hash"] - vendor.write_bytes(b"first edit\n") - first = repository_identity(superproject)["snapshot_hash"] - vendor.write_bytes(b"second edit\n") - second = repository_identity(superproject)["snapshot_hash"] - self.assertNotEqual(first, second) - self.assertTrue(repository_identity(superproject)["dirty"]) - vendor.write_bytes(original) - restored = repository_identity(superproject) - self.assertFalse(restored["dirty"]) - self.assertEqual(restored["snapshot_hash"], original_snapshot) + # Add one process-scoped option, preserving any caller-provided options. + position = int(os.environ.get("GIT_CONFIG_COUNT", "0")) + with patch.dict(os.environ, { + "GIT_CONFIG_COUNT": str(position + 1), + f"GIT_CONFIG_KEY_{position}": "core.autocrlf", + f"GIT_CONFIG_VALUE_{position}": autocrlf, + }): + superproject = self.make_superproject() + vendor = superproject / "sub" / "vendor.py" + original = vendor.read_bytes() # Preserve Git's checkout line endings. + self.assertEqual(original, b"original\r\n" if autocrlf == "true" else b"original\n") + original_snapshot = repository_identity(superproject)["snapshot_hash"] + vendor.write_bytes(b"first edit\n") + first = repository_identity(superproject)["snapshot_hash"] + vendor.write_bytes(b"second edit\n") + second = repository_identity(superproject)["snapshot_hash"] + self.assertNotEqual(first, second) + self.assertTrue(repository_identity(superproject)["dirty"]) + vendor.write_bytes(original) + restored = repository_identity(superproject) + self.assertFalse(restored["dirty"]) + self.assertEqual(restored["snapshot_hash"], original_snapshot) def test_untracked_nested_repository_is_hashed_not_unavailable(self): # Git reports an untracked nested repository as one directory entry;