Exgit.Object (exgit v0.1.0)

Copy Markdown View Source

Umbrella type + dispatch for git's four object kinds: Blob, Tree, Commit, Tag. Each has its own struct in Exgit.Object.*; this module is the common entry point for decode/encode/sha/type across all of them.

Decoding (decode/2) is tagged: pass the type atom plus raw object bytes, receive back {:ok, struct} or {:error, _}. Decoders never raise on untrusted input — see Exgit.Security.DecoderFuzzTest for the regression corpus.

Summary

Types

object_type()

@type object_type() :: :blob | :tree | :commit | :tag

sha()

@type sha() :: <<_::160>>

t()

Functions

decode(atom, bytes)

@spec decode(object_type(), binary()) :: {:ok, t()} | {:error, term()}

encode(obj)

@spec encode(t()) :: iodata()

sha(obj)

@spec sha(t()) :: sha()

type(arg1)

@spec type(t()) :: object_type()

type_string(arg1)

@spec type_string(t()) :: String.t()