diff --git a/lib/private/copy_to_directory.bzl b/lib/private/copy_to_directory.bzl index f4eb950..b34915e 100644 --- a/lib/private/copy_to_directory.bzl +++ b/lib/private/copy_to_directory.bzl @@ -146,7 +146,7 @@ if [[ -f "{src}" ]]; then cp -f "{src}" "{dst}" else mkdir -p "{dst}" - cp -fR "{src}"/* "{dst}" + cp -fR "{src}/." "{dst}" fi """.format(src = src_path, dst_dir = skylib_paths.dirname(dst_path), dst = dst_path)) diff --git a/lib/tests/copy_to_directory/BUILD.bazel b/lib/tests/copy_to_directory/BUILD.bazel index 796ac52..5778136 100644 --- a/lib/tests/copy_to_directory/BUILD.bazel +++ b/lib/tests/copy_to_directory/BUILD.bazel @@ -22,6 +22,7 @@ load("//lib:directory_path.bzl", "make_directory_paths") "expected_7", "expected_8", "expected_9", + "expected_10", ] ] @@ -232,3 +233,20 @@ diff_test( file1 = "case_8", file2 = ":expected_8", ) + +# Case 10: copy folder containing hidden file +copy_to_directory( + name = "case_10", + srcs = [ + ":dir_g", + ], + replace_prefixes = { + "dir_g": "", + }, +) + +diff_test( + name = "case_10_test", + file1 = "case_10", + file2 = ":expected_10", +) diff --git a/lib/tests/copy_to_directory/dir_expected_10/.g b/lib/tests/copy_to_directory/dir_expected_10/.g new file mode 100644 index 0000000..f6ea049 --- /dev/null +++ b/lib/tests/copy_to_directory/dir_expected_10/.g @@ -0,0 +1 @@ +foobar \ No newline at end of file diff --git a/lib/tests/copy_to_directory/dir_g/.g b/lib/tests/copy_to_directory/dir_g/.g new file mode 100644 index 0000000..f6ea049 --- /dev/null +++ b/lib/tests/copy_to_directory/dir_g/.g @@ -0,0 +1 @@ +foobar \ No newline at end of file