Skip to content

Commit ef0e544

Browse files
cliffhallclaude
andcommitted
test(git): make a GHSA-r2q8-f657-4r56 test's precondition hold on every git
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: cliffhall <cliff@futurescale.com>
1 parent 70e1b0f commit ef0e544

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎src/git/tests/test_index_entries.py‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,11 @@ async def test_untracked_cache_naming_outside_is_ignored(tmp_path: Path):
222222
data = data[:at] + b"..\0" + data[at + 3 :]
223223
forged = data + hashlib.sha1(data).digest()
224224
index.write_bytes(forged)
225-
# Git honors the forged cache by default: the precondition.
225+
# Git honors the forged cache by default: the precondition. It names
226+
# the directory above the working tree either whole (`../`) or file
227+
# by file, depending on the git, so the check is on the `../` prefix.
226228
plain = repo.git.execute(["git", *own, "status", "--porcelain"])
227-
assert "outside/secret.txt" in str(plain)
229+
assert any(line[3:].startswith("../") for line in str(plain).splitlines())
228230
index.write_bytes(forged)
229231
finally:
230232
repo.close()
@@ -233,6 +235,7 @@ async def test_untracked_cache_naming_outside_is_ignored(tmp_path: Path):
233235
text = result["content"][0]["text"]
234236
assert "zz/" in text
235237
assert "outside" not in text
238+
assert "../" not in text
236239

237240

238241
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)