@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+13
+13
src/applications/differential/query/DifferentialHunkQuery.php
··· 17 17 return $this; 18 18 } 19 19 20 + public function willExecute() { 21 + // If we fail to load any hunks at all (for example, because all of 22 + // the requested changesets are directories or empty files and have no 23 + // hunks) we'll never call didFilterPage(), and thus never have an 24 + // opportunity to attach hunks. Attach empty hunk lists now so that we 25 + // end up with the right result. 26 + if ($this->shouldAttachToChangesets) { 27 + foreach ($this->changesets as $changeset) { 28 + $changeset->attachHunks(array()); 29 + } 30 + } 31 + } 32 + 20 33 public function loadPage() { 21 34 $table = new DifferentialHunk(); 22 35 $conn_r = $table->establishConnection('r');