Skip to content

Commit 8cc6fe4

Browse files
Arturas Moskvinas arturas@uber.comepriestley
Arturas Moskvinas arturas@uber.com
authored and
epriestley
committedFeb 12, 2020
Fix diffusion.branchquery returning dictionary instead of array when branches are filtered out
Summary: `diffusion.branchquery` can return dictionary instead of array if some branches are filtered out. Eg.: ``` { "result": [ { "shortName": "master", "commitIdentifier": "2817b0d8f79748ddfad0220c46d9b20bea34f460", "refType": "branch", "rawFields": { "objectname": "2817b0d8f79748ddfad0220c46d9b20bea34f460", "objecttype": "commit", ``` might become: ``` { "result": { "1": { "shortName": "master", "commitIdentifier": "2817b0d8f79748ddfad0220c46d9b20bea34f460", "refType": "branch", "rawFields": { "objectname": "2817b0d8f79748ddfad0220c46d9b20bea34f460", "objecttype": "commit", ``` Reproduction - find repository which has couple of branches, setup to track only some of them, execute `diffusion.branchquery` API call - result is dictionary instead of array Test Plan: Apply patch, execution `diffusion.branchquery` call - result is no longer dictionary if it was one before Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Differential Revision: https://secure.phabricator.com/D20973
1 parent af84f21 commit 8cc6fe4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed
 

‎src/applications/diffusion/conduit/DiffusionBranchQueryConduitAPIMethod.php

+2
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ private function processBranchRefs(ConduitAPIRequest $request, array $refs) {
128128
$refs = array_slice($refs, 0, $limit);
129129
}
130130

131+
$refs = array_values($refs);
132+
131133
return mpull($refs, 'toDictionary');
132134
}
133135

0 commit comments

Comments
 (0)
Failed to load comments.