@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 an issue with incorrect split head detection in Mercurial after pushing a medley of varied changes

Summary:
Fixes T10665. See that task for discussion.

Because `$head_map` is not properly re-initialized for each ref we check, pushes which affect multiple branches (say, "A" and "B") can have information bleed from the first branch check to the second branch.

To trigger a problem behavior, you can push one commit which updates an existing branch, plus one commit which creates a new branch. If they process in the right order, the `$head_map` from the updated branch will bleed into the `$head_map` for the new branch and trigger an incorrect head split detection.

Test Plan:
- Pushed a set of changes which updated `branch-a` and created `branch-b`.
- Before change: improper detection of split heads.
- After change: clean push.
- Pushed a set of changes which split the head of `branch-d`.
- Correct detection of split heads.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10665

Differential Revision: https://secure.phabricator.com/D15522

+1 -2
+1 -2
src/applications/diffusion/engine/DiffusionCommitHookEngine.php
··· 770 770 } 771 771 772 772 $stray_heads = array(); 773 + $head_map = array(); 773 774 774 775 if ($old_heads && !$new_heads) { 775 776 // This is a branch deletion with "--close-branch". 776 - $head_map = array(); 777 777 foreach ($old_heads as $old_head) { 778 778 $head_map[$old_head] = array(self::EMPTY_HASH); 779 779 } ··· 798 798 '{node}\1'); 799 799 } 800 800 801 - $head_map = array(); 802 801 foreach (new FutureIterator($dfutures) as $future_head => $dfuture) { 803 802 list($stdout) = $dfuture->resolvex(); 804 803 $descendant_heads = array_filter(explode("\1", $stdout));