Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions plugins/codex-security/scripts/generate_rank_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ def run_git_changed_paths(repo: Path, diff_args: list[str]) -> list[tuple[Path,
"-z",
"--diff-filter=ACMRDT",
*diff_args,
"--",
text=False,
)
result.check_returncode()
Expand Down
16 changes: 16 additions & 0 deletions plugins/codex-security/tests/test_generate_rank_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,22 @@ def test_make_diff_rank_input_combines_staged_and_unstaged_patch(tmp_path: Path)
]


def test_make_diff_rank_input_accepts_base_that_matches_a_path(tmp_path: Path) -> None:
repo = tmp_path / "repo"
(repo / "release").mkdir(parents=True)
initialize_repo(repo)
(repo / "release" / "build.py").write_text("build = 1", encoding="utf-8")
git(repo, "add", ".")
git(repo, "commit", "-qm", "base")
git(repo, "branch", "release")
(repo / "release" / "build.py").write_text("build = 2", encoding="utf-8")
output = tmp_path / "patch.jsonl"

run_repo_cli("make-diff-rank-input", repo, output, "--base", "release", "--mode", "local-patch")

assert [row["path"] for row in read_jsonl(output)] == ["release/build.py"]


@pytest.mark.parametrize("mode", ["revisions", "local-patch"])
def test_make_rank_input_decodes_bom_marked_utf16_source(tmp_path: Path, mode: str) -> None:
repo = tmp_path / "repo"
Expand Down
Loading