@@ -40,6 +40,7 @@ import {
4040 PatchState ,
4141 savePatchApplicationState ,
4242 STATE_FILE_NAME ,
43+ verifyAppliedPatches ,
4344} from "./stateFile"
4445
4546function printNoPackageFoundError (
@@ -92,8 +93,10 @@ export function makePatch({
9293 mode = { type : "append" , name : "initial" }
9394 }
9495
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+ 97100 if (
98101 mode . type === "overwrite_last" &&
99102 isRebasing &&
@@ -424,12 +427,8 @@ export function makePatch({
424427 // scoped package
425428 mkdirSync ( dirname ( patchPath ) )
426429 }
427- writeFileSync ( patchPath , diffResult . stdout )
428- console . log (
429- `${ chalk . green ( "β" ) } Created file ${ join ( patchDir , patchFileName ) } \n` ,
430- )
431430
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
433432 if ( isRebasing && mode . type === "append" ) {
434433 const patchesToNudge = existingPatches . slice ( state ! . patches . length )
435434 if ( sequenceNumber === undefined ) {
@@ -460,6 +459,11 @@ export function makePatch({
460459 }
461460 }
462461
462+ writeFileSync ( patchPath , diffResult . stdout )
463+ console . log (
464+ `${ chalk . green ( "β" ) } Created file ${ join ( patchDir , patchFileName ) } \n` ,
465+ )
466+ 463467 const prevState : PatchState [ ] = patchesToApplyBeforeDiffing . map (
464468 ( p ) : PatchState => ( {
465469 patchFilename : p . patchFilename ,
0 commit comments