sindresorhus / gulp-changed

Only pass through changed files
MIT License
742 stars 44 forks source link

compareLastModifiedTime with replaced files #79

Open Allain55 opened 4 years ago

Allain55 commented 4 years ago

Hi,

if I replace 1 file with another file than the compareLastModifiedTime method won't work if the new file was modified earlier. I think this method should also check the birthtime from the stats

My suggestion is to replace this: Math.floor(sourceFile.stat.mtimeMs) > Math.floor(targetStat.mtimeMs)

With something like this:

Math.max(
                Math.floor(sourceFile.stat.mtimeMs),
                Math.floor(sourceFile.stat.birthtimeMs),
            ) > Math.floor(targetStat.mtimeMs)