mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 12:00:55 +01:00
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
This commit is contained in:
parent
3493d9d513
commit
4dc857e36d
1 changed files with 1 additions and 2 deletions
|
@ -770,10 +770,10 @@ final class DiffusionCommitHookEngine extends Phobject {
|
|||
}
|
||||
|
||||
$stray_heads = array();
|
||||
$head_map = array();
|
||||
|
||||
if ($old_heads && !$new_heads) {
|
||||
// This is a branch deletion with "--close-branch".
|
||||
$head_map = array();
|
||||
foreach ($old_heads as $old_head) {
|
||||
$head_map[$old_head] = array(self::EMPTY_HASH);
|
||||
}
|
||||
|
@ -798,7 +798,6 @@ final class DiffusionCommitHookEngine extends Phobject {
|
|||
'{node}\1');
|
||||
}
|
||||
|
||||
$head_map = array();
|
||||
foreach (new FutureIterator($dfutures) as $future_head => $dfuture) {
|
||||
list($stdout) = $dfuture->resolvex();
|
||||
$descendant_heads = array_filter(explode("\1", $stdout));
|
||||
|
|
Loading…
Reference in a new issue