Skip to content

test(promote): add test for directory-to-file target change in non-optional diff - #14370

Merged
Alizter merged 1 commit into
ocaml:mainfrom
Alizter:push-omrztyyqpxnx
Apr 29, 2026
Merged

Alizter merged 1 commit into
ocaml:mainfrom
Alizter:push-omrztyyqpxnx

Conversation

@Alizter

@Alizter Alizter commented Apr 29, 2026

Copy link
Copy Markdown
Collaborator

When a rule changes from producing a directory target to a file target between builds, the Copy path in register_intermediate fails with "_build/.promotion-staging/expected: Is a directory" because the old staging directory is not cleaned up.

…tional diff

When a rule changes from producing a directory target to a file target between
builds, the Copy path in register_intermediate fails with
"_build/.promotion-staging/expected: Is a directory" because the old staging
directory is not cleaned up.

Signed-off-by: Ali Caglayan <[email protected]>
@Alizter
Alizter merged commit 1dd2eea into ocaml:main Apr 29, 2026
29 checks passed
@Alizter
Alizter deleted the push-omrztyyqpxnx branch April 29, 2026 17:39
Alizter added a commit that referenced this pull request Apr 30, 2026
…ntermediate (#14371)

When a promoted target changes from a directory to a file between
builds, the
old staging path remains as a directory. Unix.rename and Io.copy_file
cannot
overwrite a directory with a file, causing "Is a directory" errors.

Fix by unlinking the staging path before writing, using rm_rf only when
it's a
directory. This handles both the Move path (cram tests, optional diffs)
and the
Copy path (non-optional diffs with directory targets).

Updates dir-to-file-promotion.t and dir-to-file-target-change.t to
reflect the
fix.

- fixes #5647
- fixes #6575
- [x] depends on #14370 
- [x] depends on #14369 
- [x] changes
@Alizter Alizter added this to the 3.24.0 milestone Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant