@@ -40,6 +40,7 @@ import {
40
40
PatchState ,
41
41
savePatchApplicationState ,
42
42
STATE_FILE_NAME ,
43
+ verifyAppliedPatches ,
43
44
} from "./stateFile"
44
45
45
46
function printNoPackageFoundError (
@@ -92,8 +93,10 @@ export function makePatch({
92
93
mode = { type : "append" , name : "initial" }
93
94
}
94
95
95
- // TODO: verify applied patch hashes
96
- // TODO: handle case where rebase appending and the name is the same as the next one in the sequence
96
+ if ( isRebasing && state ) {
97
+ verifyAppliedPatches ( { appPath, patchDir, state } )
98
+ }
99
+
97
100
if (
98
101
mode . type === "overwrite_last" &&
99
102
isRebasing &&
@@ -424,12 +427,8 @@ export function makePatch({
424
427
// scoped package
425
428
mkdirSync ( dirname ( patchPath ) )
426
429
}
427
- writeFileSync ( patchPath , diffResult . stdout )
428
- console . log (
429
- `${ chalk . green ( "✔" ) } Created file ${ join ( patchDir , patchFileName ) } \n` ,
430
- )
431
430
432
- // if we inserted a new patch into a sequence we may need to update the sequence numbers
431
+ // if we are inserting a new patch into a sequence we most likely need to update the sequence numbers
433
432
if ( isRebasing && mode . type === "append" ) {
434
433
const patchesToNudge = existingPatches . slice ( state ! . patches . length )
435
434
if ( sequenceNumber === undefined ) {
@@ -460,6 +459,11 @@ export function makePatch({
460
459
}
461
460
}
462
461
462
+ writeFileSync ( patchPath , diffResult . stdout )
463
+ console . log (
464
+ `${ chalk . green ( "✔" ) } Created file ${ join ( patchDir , patchFileName ) } \n` ,
465
+ )
466
+
463
467
const prevState : PatchState [ ] = patchesToApplyBeforeDiffing . map (
464
468
( p ) : PatchState => ( {
465
469
patchFilename : p . patchFilename ,
0 commit comments