Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core: add support for wipe arg to Directory.export (#6909)
* core: add support for wipe arg to Directory.export By default, exporting a directory resulted in its contents being merged into the target directory on the host, with any files that existed on the host but not in the source dir being untouched during the export. More often than not, this is the behavior you want, but there are use cases where you'd instead like to replace the contents of the host directory entirely such that it exactly matches the source dir being exported. This enables you to e.g. load a dir from the host, delete some files from it and then export that back to the host with those deletes being reflected. This change adds an arg to `Directory.export` to enable that behavior. I really wanted to name the arg `merge` and default it to `true`, but it turns out that doesn't really work for optional args since at least the Go SDK can't distinguish between an explicit `false` value on an optional arg and an explicitly set `false`, so it wasn't possible to ever get anything but the `merge: true` behavior. Didn't check other SDKs but I would imagine at least a few of them have the same sort of problem. So I fell back to just naming the arg `wipe` and making it trigger the non-default behavior only when set to true. Signed-off-by: Erik Sipsma <erik@dagger.io> * update phrasing in wipe docs Signed-off-by: Erik Sipsma <erik@dagger.io> --------- Signed-off-by: Erik Sipsma <erik@dagger.io>
- Loading branch information