From 9b56327bfea330092978c07289165499484512bc Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Thu, 1 Dec 2022 11:26:00 -0800 Subject: [PATCH] Fixes folder timestamps being updated before copying files into them (#2964) (#2976) * When updating the timestamps were requested, scanCopy first set the times and then copied content into the destination folder. On certain platforms, copying files into a folder updates its "Last Access Time" and that overwrites the just set timestamps. This PR, makes sure the timestamps are set only after copying the content. Signed-off-by: Miki Signed-off-by: Miki (cherry picked from commit 5dc0212c7748fd4b8b23a9c5f5843906dc9529c5) Signed-off-by: github-actions[bot] # Conflicts: # CHANGELOG.md Co-authored-by: github-actions[bot] --- src/dev/build/lib/scan_copy.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dev/build/lib/scan_copy.ts b/src/dev/build/lib/scan_copy.ts index 71d486fad0b2..e806c0ef91ab 100644 --- a/src/dev/build/lib/scan_copy.ts +++ b/src/dev/build/lib/scan_copy.ts @@ -104,13 +104,13 @@ export async function scanCopy(options: Options) { await copyFileAsync(record.absolute, record.absoluteDest, Fs.constants.COPYFILE_EXCL); } - if (time) { - await utimesAsync(record.absoluteDest, time, time); - } - if (record.isDirectory) { await copyChildren(record); } + + if (time) { + await utimesAsync(record.absoluteDest, time, time); + } }; await mkdirp(destination);