yocaml icon indicating copy to clipboard operation
yocaml copied to clipboard

Yocaml_git never removes files

Open reynir opened this issue 1 year ago • 3 comments

We have a setup where we previously generated files tags/{{ tag }}.html. Now, after refactoring, we generate a single tags.html file. However, when using Yocaml_git the tags/ directory and its children are still present in the git tree. In other words, if a run using Yocaml_git no longer generates a file it will still be present. Is this the expected behavior? What should we do about files we don't generate anymore? An explicit delete?

reynir avatar Oct 23 '24 08:10 reynir

An explicit delete?

From my point of view, it's currently the only valid way to clean-up the Git repository. The YOCaml engine just add or set files, it never remove anything (and it does not know something about the "previous" state of Git). We can think about something like an append-only store.

dinosaure avatar Oct 23 '24 09:10 dinosaure

This is a question that was asked a lot after the release of version 1 of YOCaml. One of the proposals was to use a Writer Monad to track the files to be built and then use a diff with the generated filetree to purge unnecessary files. The problem with this approach is that it causes problems in several scenarios :/

What's more, with the dynamic dependency model (and the fact that a Task can produce files), it makes the metrics for the artefacts created quite tricky. So for the moment, we're using the legendary ostrich approach, pretend nothing's happened and let the user deal with the let the user deal with the problem of orphan artefacts, in particular by not orphan artefacts, in particular by simply not linking to them from a collection of pages produced. In practice, building a YOCaml site in the CI is very costly because you have to re-download the dependencies and therefore keep the minimality calculation for the (via the local server) and deleting the state each time it is reconstruction seems the most reasonable proposal.

gr-im avatar Oct 23 '24 13:10 gr-im

Is this lack of response satisfactory and can we close the issue @reynir?

xhtmlboi avatar Oct 25 '24 09:10 xhtmlboi

Perhaps it can be mentioned somewhere in the documentation? Thanks for the replies

reynir avatar Nov 01 '24 08:11 reynir