Documentation
¶
Overview ¶
Command ripgrepfetch puts the ripgrep archives internal/ripgrep pins into its assets directory, where the next build embeds them (`make ripgrep`).
Each archive is downloaded only when the directory does not already hold a regular file of that name with the pinned sha256, and lands only once its own bytes hash to the pin: a download is written beside its target under a dot name the embed never picks up, and renamed into place after the digest matches. What stands at an archive's name and is not a regular file is not one the embed takes — go:embed skips a symbolic link in a directory it embeds — so a link to a regular file that holds the pin is replaced by a regular copy of those bytes, checked the same way, and a link to anything else, a directory or any other kind of file there is removed and the archive fetched. An archive the directory already holds is left 0644, as a download lands, where its mode can be changed; where it cannot, it is taken as it is, and the refusal logged. One this user cannot read is replaced. Then everything else in the directory is removed — an archive the manifest no longer names, an interrupted download, a stray file or directory — but the manifest: internal/ripgrep embeds the whole directory, since a build made without the archives must still compile, so what it holds is what a build carries, and this leaves it the manifest and the pin. A host that cannot reach GitHub can put the archives there by any other route; they are checked all the same.