mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-20 05:42:40 +01:00
Fix a HunkQuery issue where no hunks load at all
Summary: If you create a diff with no hunks (e.g., it adds a single empty file), we never attachHunks() so we throw on getHunks(). Instead, make sure changesets get hunks attached if they expect it. Test Plan: Created a new diff with a single empty file in it. Reviewers: btrahan Reviewed By: btrahan Subscribers: zeeg, epriestley Differential Revision: https://secure.phabricator.com/D8842
This commit is contained in:
parent
4bbd2d5203
commit
5f033d580c
1 changed files with 13 additions and 0 deletions
|
@ -17,6 +17,19 @@ final class DifferentialHunkQuery
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function willExecute() {
|
||||
// If we fail to load any hunks at all (for example, because all of
|
||||
// the requested changesets are directories or empty files and have no
|
||||
// hunks) we'll never call didFilterPage(), and thus never have an
|
||||
// opportunity to attach hunks. Attach empty hunk lists now so that we
|
||||
// end up with the right result.
|
||||
if ($this->shouldAttachToChangesets) {
|
||||
foreach ($this->changesets as $changeset) {
|
||||
$changeset->attachHunks(array());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function loadPage() {
|
||||
$table = new DifferentialHunk();
|
||||
$conn_r = $table->establishConnection('r');
|
||||
|
|
Loading…
Reference in a new issue