mirror of
https://github.com/smogon/sprites.git
synced 2026-12-04 14:07:57 -06:00
A served name carries a content hash, so a reader that composes a fixed path can't find one. The way out is to publish the set twice, once under the stamped names and once under the bare ones, and a link is the one thing the queue couldn't say: Copy dereferences and Write has bytes. Add a Symlink op beside them. What ctx.symlink takes is not a link target but the destination of the thing being named, since a published tree is unpacked somewhere else and its halves can land apart; the path between the two is computed here and is what gets written. It takes the same duplicate-dst and absolute-dst checks the other ops do, plus one of its own -- resolved lexically against the directory it sits in, a target has to stay inside the tree, since the receiving side extracts as root and a link that walks out of it is the same write to anywhere that an absolute member name is. run() makes a real symlink in every mode, clearing the name first so a rerun over an existing tree behaves the way copy and write already do, and pack() emits a symlink member with no body, which is what a stream reader on the other end sees. refactor digests bytes, and a link has none; what it publishes is the name it points at, so that is what it records and what a retarget shows up as. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>