diff --git a/src/client/metadataApiRetrieve.ts b/src/client/metadataApiRetrieve.ts index a3d80747aa..bef98b524b 100644 --- a/src/client/metadataApiRetrieve.ts +++ b/src/client/metadataApiRetrieve.ts @@ -367,7 +367,17 @@ export class MetadataApiRetrieve extends MetadataTransfer< const localComp = partialDeleteComponents.get(comp.fullName); if (localComp.contentPath && tree.isDirectory(comp.content)) { const remoteContentList = tree.readDirectory(comp.content); - let deleteLocalComp = false; + + const isForceIgnored = (filePath: string): boolean => { + const ignored = comp.getForceIgnore().denies(filePath); + if (ignored) { + this.logger.debug( + `Local component has ${filePath} while remote does not, but it is forceignored so ignoring.` + ); + } + return ignored; + }; + localComp.contentList.forEach((fileName) => { if (!remoteContentList.includes(fileName)) { // If fileName is forceignored it is not counted as a diff. If fileName is a directory @@ -376,30 +386,27 @@ export class MetadataApiRetrieve extends MetadataTransfer< const fileNameFullPath = path.join(localComp.contentPath, fileName); if (fs.statSync(fileNameFullPath).isDirectory()) { const nestedFiles = fs.readdirSync(fileNameFullPath); - if (nestedFiles.some((f) => comp.getForceIgnore().denies(path.join(fileNameFullPath, f)))) { - this.logger.debug( - `Local component has ${fileNameFullPath} while remote does not, but it is forceignored so ignoring.` - ); + if (nestedFiles.some((f) => isForceIgnored(path.join(fileNameFullPath, f)))) { return; } + } else if (isForceIgnored(fileNameFullPath)) { + return; } this.logger.debug( `Local component (${comp.fullName}) contains ${fileName} while remote component does not. This file is being removed.` ); - deleteLocalComp = true; + + const filePath = path.join(localComp.contentPath, fileName); partialDeleteFileResponses.push({ fullName: comp.fullName, type: comp.type.name, state: ComponentStatus.Deleted, - filePath: path.join(localComp.contentPath, fileName), + filePath, }); + fs.rmSync(filePath, { recursive: true, force: true }); } }); - if (deleteLocalComp) { - this.logger.debug(`Replacing local component: ${localComp.contentPath} with same component from org`); - fs.rmSync(localComp.contentPath, { recursive: true, force: true }); - } } } }); diff --git a/test/nuts/perfResults/x64-linux-2xIntel-Xeon-Platinum-8272CL-CPU-2-60GHz/eda.json b/test/nuts/perfResults/x64-linux-2xIntel-Xeon-Platinum-8272CL-CPU-2-60GHz/eda.json new file mode 100644 index 0000000000..7d1746cf2a --- /dev/null +++ b/test/nuts/perfResults/x64-linux-2xIntel-Xeon-Platinum-8272CL-CPU-2-60GHz/eda.json @@ -0,0 +1,18 @@ +[ + { + "name": "componentSetCreate", + "duration": 206.49349700001767 + }, + { + "name": "sourceToMdapi", + "duration": 5455.362960000028 + }, + { + "name": "sourceToZip", + "duration": 5237.455126999994 + }, + { + "name": "mdapiToSource", + "duration": 3759.678862999979 + } +] \ No newline at end of file diff --git a/test/nuts/perfResults/x64-linux-2xIntel-Xeon-Platinum-8272CL-CPU-2-60GHz/lotsOfClasses.json b/test/nuts/perfResults/x64-linux-2xIntel-Xeon-Platinum-8272CL-CPU-2-60GHz/lotsOfClasses.json new file mode 100644 index 0000000000..6a2b34644c --- /dev/null +++ b/test/nuts/perfResults/x64-linux-2xIntel-Xeon-Platinum-8272CL-CPU-2-60GHz/lotsOfClasses.json @@ -0,0 +1,18 @@ +[ + { + "name": "componentSetCreate", + "duration": 407.67415299999993 + }, + { + "name": "sourceToMdapi", + "duration": 7544.196715999977 + }, + { + "name": "sourceToZip", + "duration": 6185.875728999992 + }, + { + "name": "mdapiToSource", + "duration": 4336.305462999997 + } +] \ No newline at end of file diff --git a/test/nuts/perfResults/x64-linux-2xIntel-Xeon-Platinum-8272CL-CPU-2-60GHz/lotsOfClassesOneDir.json b/test/nuts/perfResults/x64-linux-2xIntel-Xeon-Platinum-8272CL-CPU-2-60GHz/lotsOfClassesOneDir.json new file mode 100644 index 0000000000..298a241001 --- /dev/null +++ b/test/nuts/perfResults/x64-linux-2xIntel-Xeon-Platinum-8272CL-CPU-2-60GHz/lotsOfClassesOneDir.json @@ -0,0 +1,18 @@ +[ + { + "name": "componentSetCreate", + "duration": 704.1282699999865 + }, + { + "name": "sourceToMdapi", + "duration": 10994.699290999997 + }, + { + "name": "sourceToZip", + "duration": 9647.811220000003 + }, + { + "name": "mdapiToSource", + "duration": 8051.59345700001 + } +] \ No newline at end of file