Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: add support for wipe arg to Directory.export #6909

Merged
merged 2 commits into from
Mar 22, 2024

Commits on Mar 21, 2024

  1. 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>
    sipsma committed Mar 21, 2024
    Configuration menu
    Copy the full SHA
    c348df6 View commit details
    Browse the repository at this point in the history
  2. update phrasing in wipe docs

    Signed-off-by: Erik Sipsma <erik@dagger.io>
    sipsma committed Mar 21, 2024
    Configuration menu
    Copy the full SHA
    41a61d2 View commit details
    Browse the repository at this point in the history