Diff patch is not happening at correct commit and unrelated changes in master shown

#1
by sammiebae - opened

hello, I have not measured how widespread this is but I've noticed that the patch is not always correct

Example:
https://github.com/JuliaDebug/Cthulhu.jl/pull/481/changes
only changes 1 file
but when you run:

from datasets import load_dataset

row = next(r for r in load_dataset("nebius/SWE-rebench-V2-PRs", split="train", streaming=True)
           if r["instance_id"] == "juliadebug__cthulhu.jl-481")
print(row["base_commit"], sum(p.count("diff --git ") for p in (row["patch"], row["patch"])))

the diff patch has lot more changes.
running above prints: a017a4d8ccafcd7b8690b86cc6722a1ee544d61c 38

which shows that they are 38 file paths in the diff whereas the real PR only had 1

Nebius org

Hi! Thanks for reporting this.
We did not use the GitHub API to generate the patches because of API limits. Instead, we reconstructed them directly from the repositories.
For some PRs, the original head_commit is no longer available, often because the PR was squash-merged. In those cases, we generated the patch as the difference between the base_commit and the merge_commit. This difference may contain changes that were not part of the original PR, as in your example.
I have now added meta.commit_name to the dataset. Its value is either head_commit or merge_commit.

You can filter for rows where:

row["meta"]["commit_name"] == "head_commit"

Those patches should match the original PR more reliably. Rows marked as merge_commit should be used more carefully, since their patches may include additional changes.

gotcha thanks @ibragim-bad !

Sign up or log in to comment