Skip to content

Commit

Permalink
Merge pull request #70 from tiktok/fix-dedup-temporary-selections
Browse files Browse the repository at this point in the history
  • Loading branch information
jzhang026 authored May 10, 2024
2 parents b8bec76 + 5536114 commit c5f41d8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
23 changes: 15 additions & 8 deletions apps/sparo-lib/src/services/SparoProfileService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,18 +344,25 @@ ${availableProfiles.join(',')}
const fromSelector: Set<string> = fromProjects || new Set();
// If Rush Selector --to <projects> is specified, using `git sparse-checkout add` to add folders of the projects specified
const projectsSelections: ISelection[] = [...rushSelectorState];
const existingSelections: Set<string> = new Set<string>(
rushSelectorState.map(({ selector, argument }) => `${selector}$$${argument}`)
);

for (const project of toSelector) {
projectsSelections.push({
selector: '--to',
argument: project
});
if (!existingSelections.has(`--to$$${project}`)) {
projectsSelections.push({
selector: '--to',
argument: project
});
}
}
for (const project of fromSelector) {
projectsSelections.push({
selector: '--from',
argument: project
});
if (!existingSelections.has(`--from$$${project}`)) {
projectsSelections.push({
selector: '--from',
argument: project
});
}
}

if (projectsSelections.length > 0) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "sparo",
"comment": "",
"type": "none"
}
],
"packageName": "sparo"
}

0 comments on commit c5f41d8

Please sign in to comment.