Ensure consistent ordering of filediffs for patch generation.
Review Request #14375 — Created March 19, 2025 and updated
When generating diffs from FileDiffs or results for the FileDiff
resource, we were using the database's default sort order. For MySQL and
MariaDB, this is going to be the primary key, but that's not guaranteed
for Postgres. For Postgres, we can get an entirely different order.This can pose a problem for diffs that are sensitive to file orders,
namely Mercurial, which contains identifying information for the commit
in the first file. We need these to be in the insert order, as that's
the order in which we parse from the sourcediff.We now explicitly sort these by the primary key in these cases. We're
not setting this as the default sort order at this time, in order to
avoid any surprises elsewhere, and to be explicit about the order we
know we need in these particular cases.
Unit tests pass.
Verified this fix with a customer who had previously encountered
this issue.
Summary | ID |
---|---|
589f90b635cb1b572c267efe05d175848028d211 |