Skip to content

copier: add AddAndCopyOptions.DirCopyContents#6816

Open
akca wants to merge 2 commits intocontainers:mainfrom
akca:copier-dircopycontents
Open

copier: add AddAndCopyOptions.DirCopyContents#6816
akca wants to merge 2 commits intocontainers:mainfrom
akca:copier-dircopycontents

Conversation

@akca
Copy link
Copy Markdown
Contributor

@akca akca commented Apr 28, 2026

What type of PR is this?

/kind feature

What this PR does / why we need it:

Adds a new AddAndCopyOptions.DirCopyContents field (of type types.OptionalBool) that controls whether copying a source directory copies just its contents (default, true) or the directory itself with its contents nested below it.

This wires the existing GetOptions.KeepDirectoryNames setting through the AddAndCopyOptions API, aligning with BuildKit's FileAction_Copy.dirCopyContents logic.

How to verify it

Which issue(s) this PR fixes:

Fixes #6803

Special notes for your reviewer:

KeepDirectoryNames is the opposite of DirCopyContents: DirCopyContents == OptionalBoolFalse maps to KeepDirectoryNames = true. Both OptionalBoolUndefined and OptionalBoolTrue preserve existing default behavior (copy contents only). The added test covers this inversion logic only, since KeepDirectoryNames already has tests in copier/copier_test.go.

Does this PR introduce a user-facing change?

None

Signed-off-by: Fatih Akca <fatihakca5@gmail.com>
@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Apr 28, 2026
Comment thread add.go Outdated
Comment thread add.go Outdated
Signed-off-by: Fatih Akca <fatihakca5@gmail.com>
@akca akca requested a review from TomSweeneyRedHat April 29, 2026 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for Op_File.Actions.FileAction_Copy.DirCopyContents

2 participants