bazel-lib icon indicating copy to clipboard operation
bazel-lib copied to clipboard

Consider failing by default when copy_to_directory encounters conflicting files

Open kormide opened this issue 2 years ago • 3 comments

Silently ignoring conflicts and not overwriting could be a source of tricky to find bugs. Both ignore and overwrite behaviours should be explicitly declared.

fyi @devversion

kormide avatar Jul 18 '22 17:07 kormide

Suppose we turn allow_overwrites into a conflict_strategy attribute with enum options overwrite, ignore and fail defaulting to fail.

gregmagolan avatar Jul 28 '22 19:07 gregmagolan

Yeah I was thinking something along those lines as well.

kormide avatar Jul 28 '22 19:07 kormide

Only downside is that there isn't an easy way to do this check with cp. We have to add some more complicated logic to search for potential conflicts first (I think).

kormide avatar Jul 28 '22 19:07 kormide

New impl will fail if there are conflicts and allow_overwrites is False on all platforms. Closing this. If we want to switch to a conflict_strategy attribute in the future then lets open up a new FR

gregmagolan avatar Jan 17 '23 19:01 gregmagolan