From fc08a9b0cd9d02ee181bb04caacc7fcfed56720c Mon Sep 17 00:00:00 2001 From: HEESEUNG Date: Sun, 25 Aug 2024 01:50:57 +0900 Subject: [PATCH] fs: refactor handleTimestampsAndMode to remove redundant call Refactored the `handleTimestampsAndMode` function to eliminate the redundant `setDestTimestampsAndMode` call. This simplifies the function by ensuring that `setDestTimestampsAndMode` is only called once after any necessary modifications to file writability. PR-URL: https://github.com/nodejs/node/pull/54369 Reviewed-By: Yagiz Nizipli Reviewed-By: Luigi Pinca Reviewed-By: Minwoo Jung --- lib/internal/fs/cp/cp.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/internal/fs/cp/cp.js b/lib/internal/fs/cp/cp.js index f59bbdb1e59e61..0724eb730db058 100644 --- a/lib/internal/fs/cp/cp.js +++ b/lib/internal/fs/cp/cp.js @@ -270,7 +270,6 @@ async function handleTimestampsAndMode(srcMode, src, dest) { // (through utimes call) if (fileIsNotWritable(srcMode)) { await makeFileWritable(dest, srcMode); - return setDestTimestampsAndMode(srcMode, src, dest); } return setDestTimestampsAndMode(srcMode, src, dest); }