@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 where entering the same Owners path for two repositories would incorrectly de-dupe the path

Summary:
Ref T13130. See <https://discourse.phabricator-community.org/t/unable-to-create-owners-package-with-same-path-in-multiple-repositories/1400/1>.

When you edit paths in Owners, we deduplicate similar paths, like `/x/y` and `/x/y/`. However, this logic currently only examines the paths, and incorrectly deduplicates the same path in different repositories.

Instead, consider the repository before deduplicating.

Test Plan:
- Edited an Owners package and added the path "/" in two different repositories.
- Before: only one surived the edit.
- After: both survived.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13130

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

+7 -3
+7 -3
src/applications/owners/xaction/PhabricatorOwnersPackagePathsTransaction.php
··· 108 108 // paths now. 109 109 110 110 $display_map = array(); 111 + $seen_map = array(); 111 112 foreach ($new as $key => $spec) { 112 113 $display_path = $spec['path']; 113 114 $raw_path = rtrim($display_path, '/').'/'; 114 115 115 - // If the user entered two paths which normalize to the same value 116 - // (like "src/main.c" and "src/main.c/"), discard the duplicates. 117 - if (isset($display_map[$raw_path])) { 116 + // If the user entered two paths in the same repository which normalize 117 + // to the same value (like "src/main.c" and "src/main.c/"), discard the 118 + // duplicates. 119 + $repository_phid = $spec['repositoryPHID']; 120 + if (isset($seen_map[$repository_phid][$raw_path])) { 118 121 unset($new[$key]); 119 122 continue; 120 123 } 121 124 122 125 $new[$key]['path'] = $raw_path; 123 126 $display_map[$raw_path] = $display_path; 127 + $seen_map[$repository_phid][$raw_path] = true; 124 128 } 125 129 126 130 $diffs = PhabricatorOwnersPath::getTransactionValueChanges($old, $new);