diff --git a/e2e/smoke/BUILD.bazel b/e2e/smoke/BUILD.bazel index 3e4763ea6..1a1ffa6d5 100644 --- a/e2e/smoke/BUILD.bazel +++ b/e2e/smoke/BUILD.bazel @@ -116,11 +116,11 @@ copy_directory( sh_test( name = "test_preserve_mtime", + size = "small", srcs = ["test_preserve_mtime.sh"], data = [ "d", - ":copy_to_directory_mtime_case", ":copy_directory_mtime_case", + ":copy_to_directory_mtime_case", ], - size = "small", ) diff --git a/e2e/smoke/test_preserve_mtime.sh b/e2e/smoke/test_preserve_mtime.sh index c73404d98..497587409 100755 --- a/e2e/smoke/test_preserve_mtime.sh +++ b/e2e/smoke/test_preserve_mtime.sh @@ -3,28 +3,28 @@ set -euo pipefail function main { - compareMTimes d/1 copy_to_directory_mtime_out/d/1 - compareMTimes d/1 copy_directory_mtime_out/1 + compareMTimes d/1 copy_to_directory_mtime_out/d/1 + compareMTimes d/1 copy_directory_mtime_out/1 } function compareMTimes { - local originalFile="$1" - local copiedFile="$2" + local originalFile="$1" + local copiedFile="$2" - local mtimeOriginal - mtimeOriginal="$(stat --dereference --format=%y "$originalFile")" + local mtimeOriginal + mtimeOriginal="$(stat --dereference --format=%y "$originalFile")" - local mtimeCopy - mtimeCopy="$(stat --dereference --format=%y "$copiedFile")" + local mtimeCopy + mtimeCopy="$(stat --dereference --format=%y "$copiedFile")" - if [[ "$mtimeOriginal" != "$mtimeCopy" ]]; then - echo "Preserve mtime test failed. Modify times do not match for $originalFile and $copiedFile" - echo " Original modify time: $mtimeOriginal" - echo " Copied modify time: $mtimeCopy" - return 1 - fi + if [[ "$mtimeOriginal" != "$mtimeCopy" ]]; then + echo "Preserve mtime test failed. Modify times do not match for $originalFile and $copiedFile" + echo " Original modify time: $mtimeOriginal" + echo " Copied modify time: $mtimeCopy" + return 1 + fi - echo "Preserve mtime test passed for $originalFile and $copiedFile" + echo "Preserve mtime test passed for $originalFile and $copiedFile" } main "$@" diff --git a/tools/common/copy.go b/tools/common/copy.go index c5b92c9e2..84327e5bd 100644 --- a/tools/common/copy.go +++ b/tools/common/copy.go @@ -106,10 +106,10 @@ func (w *CopyWorker) Run(wg *sync.WaitGroup) { } type CopyOpts struct { - src, dst string - srcInfo fs.FileInfo - hardlink bool - verbose bool + src, dst string + srcInfo fs.FileInfo + hardlink bool + verbose bool preserveMTime bool }