Repository navigation
Conversation
In a copy of the project (git worktree, copy-on-write clone) compiled with check_cwd: false, __mix_recompile__? looked for new templates in the original directory, so a template added in the copy was silently not compiled.
Member
|
Thanks, I pushed the cwd fix directly! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #16. The hash is now relocatable, but
__mix_recompile__?still globs the absolute root captured at compile time. In a copy of the project that reuses_build(git worktree or copy-on-write clone, compiled withcheck_cwd: false/--no-check-cwd, Elixir 1.19.2+), it looks for templates in the original checkout, so a template added in the copy is silently never compiled.Fix: store the root with
Path.relative_to_cwd/1.__mix_recompile__?runs in the project directory, so it resolves against the copy. Roots outside the project stay absolute, and a relative root hashes the same as an absolute one.Test: compile in directory A, copy it to B, add a template in B, then
__mix_recompile__?/0must return true. It fails on main. The test changes the cwd, so the test module is nowasync: false. Also adds/tmp/to.gitignorefor the@tag :tmp_dirfixtures.Context: phoenixframework/phoenix#6855
Second commit:
@external_resourceis persisted in the module's attributes, and it embedded the absolute template path. Elixir documents@external_resourcepaths as relative to the project directory, and Mix already resolves them that way, so they are now stored relative. The test asserts they are relative; it fails without the change.