Fix issue where sometimes modified timestamp file was not shown in baseline (#58623)

This commit is contained in:
Sheetal Nandi
2024-05-22 14:38:44 -07:00
committed by GitHub
parent b682ed4504
commit e02af8e36d
3 changed files with 19 additions and 2 deletions

View File

@@ -788,8 +788,8 @@ export class FileSystem {
}
private static fileDiff(container: FileSet, basename: string, changed: FileSystem, changedNode: FileInode, base: FileSystem, baseNode: FileInode, options: DiffOptions) {
while (!changedNode.buffer && changedNode.shadowRoot) changedNode = changedNode.shadowRoot;
while (!baseNode.buffer && baseNode.shadowRoot) baseNode = baseNode.shadowRoot;
changedNode = walkSameNodes(changedNode);
baseNode = walkSameNodes(baseNode);
// no difference if the nodes are the same reference
if (changedNode === baseNode) return false;
@@ -827,6 +827,15 @@ export class FileSystem {
container[basename] = new File(changedBuffer.data, { encoding: changedBuffer.encoding });
return true;
function walkSameNodes(node: FileInode) {
while (
!node.buffer &&
node.shadowRoot &&
(!options.includeChangedFileWithSameContent || node.mtimeMs === node.shadowRoot.mtimeMs)
) node = node.shadowRoot;
return node;
}
}
private static symlinkDiff(container: FileSet, basename: string, changedNode: SymlinkInode, baseNode: SymlinkInode) {

View File

@@ -565,6 +565,10 @@ function f() {
"size": 1407
}
//// [/src/third/thirdjs/output/third-output.d.ts] file changed its modified time
//// [/src/third/thirdjs/output/third-output.d.ts.map] file changed its modified time
//// [/src/third/thirdjs/output/third-output.js] file changed its modified time
//// [/src/third/thirdjs/output/third-output.js.map] file changed its modified time
Change:: Make incremental build with change in file that doesnt affect dts

View File

@@ -1390,3 +1390,7 @@ sourceFile:../first_part3.ts
"size": 1407
}
//// [/src/third/thirdjs/output/third-output.d.ts] file changed its modified time
//// [/src/third/thirdjs/output/third-output.d.ts.map] file changed its modified time
//// [/src/third/thirdjs/output/third-output.js] file changed its modified time
//// [/src/third/thirdjs/output/third-output.js.map] file changed its modified time