Liking cljdoc? Tell your friends :D

swhid.hash

Compute SWHIDs from local artifacts: content (cnt) and directory (dir) from files, directories or explicit tree entries, snapshot (snp) from a branches map.

Hashing follows the SWHID v1.2 specification and is Git-compatible: a content SWHID is the Git blob hash of the data, a directory SWHID the Git tree hash of the directory. Only JDK classes are used; runs on the JVM and Babashka.

Compute SWHIDs from local artifacts: content (cnt) and directory (dir)
from files, directories or explicit tree entries, snapshot (snp) from a
branches map.

Hashing follows the SWHID v1.2 specification and is Git-compatible: a
content SWHID is the Git blob hash of the data, a directory SWHID the
Git tree hash of the directory. Only JDK classes are used; runs on the
JVM and Babashka.
raw docstring

content-swhidclj

(content-swhid data)

SWHID map of raw content: a byte array, or a string hashed as UTF-8.

SWHID map of raw content: a byte array, or a string hashed as UTF-8.
sourceraw docstring

path-swhidclj

(path-swhid path)
(path-swhid path {:keys [exclude]})

SWHID map of a local artifact. A regular file or a symbolic link yields a :content SWHID, a directory a :directory SWHID. Inside a directory, entries of any other kind (sockets, fifos, devices) are skipped, as Git skips them; asked for directly, they are an error.

opts: {:exclude pred} -- a predicate on java.io.File; matching entries (and their subtrees) are omitted from directory hashing, e.g. #(= ".git" (.getName %)).

SWHID map of a local artifact. A regular file or a symbolic link yields
a :content SWHID, a directory a :directory SWHID. Inside a directory,
entries of any other kind (sockets, fifos, devices) are skipped, as Git
skips them; asked for directly, they are an error.

opts: {:exclude pred} -- a predicate on java.io.File; matching entries
(and their subtrees) are omitted from directory hashing, e.g.
#(= ".git" (.getName %)).
sourceraw docstring

snapshot-swhidclj

(snapshot-swhid branches)

SWHID map of a snapshot, from a branches map: branch name (string) -> {:target-type <kw> :target <value>} where :target-type is :content, :directory, :revision, :release, :snapshot (:target is a 40-hex id), :alias (:target is a branch name) or :dangling (:target is nil).

SWHID map of a snapshot, from a branches map: branch name (string) ->
{:target-type <kw> :target <value>} where :target-type is :content,
:directory, :revision, :release, :snapshot (:target is a 40-hex id),
:alias (:target is a branch name) or :dangling (:target is nil).
sourceraw docstring

tree-swhidsclj

(tree-swhids path)
(tree-swhids path {:keys [exclude]})

Map of relative path -> SWHID map for the directory at path and every entry under it, in a single pass. The root directory is keyed by "."; entries use "/"-separated paths relative to the root. Files and symbolic links map to :content SWHIDs, directories to :directory ones. Same opts as path-swhid.

Map of relative path -> SWHID map for the directory at `path` and every
entry under it, in a single pass. The root directory is keyed by ".";
entries use "/"-separated paths relative to the root. Files and
symbolic links map to :content SWHIDs, directories to :directory ones.
Same opts as path-swhid.
sourceraw docstring

tree-swhids-from-entriesclj

(tree-swhids-from-entries entries)

Like tree-swhids, but from an explicit list of leaves instead of a directory walk: entries maps a "/"-separated relative path to {:mode m :hash h}, with m the Git mode ("100644", "100755", "120000" or "160000" for a submodule) and h the 40-hex Git hash of the blob (or of the submodule's commit). Returns relpath -> SWHID map for every leaf and every intermediate directory, the root under ".".

Like tree-swhids, but from an explicit list of leaves instead of a
directory walk: `entries` maps a "/"-separated relative path to
{:mode m :hash h}, with m the Git mode ("100644", "100755",
"120000" or "160000" for a submodule) and h the 40-hex Git hash of
the blob (or of the submodule's commit). Returns relpath -> SWHID map
for every leaf and every intermediate directory, the root under ".".
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close