@@ -8,7 +8,7 @@ import FetchImpl from '../../impl/artifacts/FetchImpl';
8
8
import ReleaseDefinitionSchema from '../../impl/release/ReleaseDefinitionSchema' ;
9
9
import path = require( 'path' ) ;
10
10
import ArtifactFetcher , { Artifact } from '@dxatscale/sfpowerscripts.core/lib/artifacts/ArtifactFetcher' ;
11
- import SfpPackage from '@dxatscale/sfpowerscripts.core/lib/package/SfpPackage' ;
11
+ import SfpPackage , { PackageType } from '@dxatscale/sfpowerscripts.core/lib/package/SfpPackage' ;
12
12
import SfpPackageBuilder from '@dxatscale/sfpowerscripts.core/lib/package/SfpPackageBuilder' ;
13
13
import SFPLogger , { ConsoleLogger , Logger , LoggerLevel } from '@dxatscale/sfp-logger' ;
14
14
import SfpPackageInquirer from '@dxatscale/sfpowerscripts.core/lib/package/SfpPackageInquirer' ;
@@ -219,11 +219,22 @@ export default class Patch extends SfpowerscriptsCommand {
219
219
//Create new path as mentioned in artifact
220
220
fs . mkdirpSync ( path . join ( temporaryWorkingDirectory , sfpPackage . packageDirectory ) ) ;
221
221
222
- //Copy from artifacts to each package directory
223
- fs . copySync (
224
- path . join ( sfpPackage . sourceDir , sfpPackage . packageDirectory ) ,
225
- path . join ( temporaryWorkingDirectory , sfpPackage . packageDirectory )
226
- ) ;
222
+
223
+ //Copy from artifacts to each package directory
224
+ //If diff, artifact will only contain delta, so use the version control to checkout the entire reference
225
+ if ( sfpPackage . packageType == PackageType . Diff )
226
+ {
227
+
228
+ await git . checkoutPath ( sfpPackage . commitSHATo , sfpPackage . packageDirectory ) ;
229
+ }
230
+ else
231
+ {
232
+ fs . copySync (
233
+ path . join ( sfpPackage . sourceDir , sfpPackage . packageDirectory ) ,
234
+ path . join ( temporaryWorkingDirectory , sfpPackage . packageDirectory )
235
+ ) ;
236
+ }
237
+
227
238
SFPLogger . log (
228
239
COLOR_KEY_MESSAGE (
229
240
`Succesfully copied from artifact ${ sfpPackage . packageName } ${ sfpPackage . package_version_number } to target directory`
0 commit comments