module Agate
Defined in:
agate.cragate/annotated_commit.cr
agate/apply.cr
agate/attr.cr
agate/blame.cr
agate/blob.cr
agate/branch.cr
agate/branch_collection.cr
agate/buffer.cr
agate/cert.cr
agate/checkout.cr
agate/cherrypick.cr
agate/commit.cr
agate/common.cr
agate/config.cr
agate/credentials.cr
agate/describe.cr
agate/diff.cr
agate/email.cr
agate/errors.cr
agate/filter.cr
agate/global.cr
agate/graph.cr
agate/ignore.cr
agate/index.cr
agate/indexer.cr
agate/init_options.cr
agate/mailmap.cr
agate/merge.cr
agate/message.cr
agate/net.cr
agate/notes.cr
agate/object.cr
agate/odb.cr
agate/odb_backend.cr
agate/oid.cr
agate/oidarray.cr
agate/pack.cr
agate/patch.cr
agate/pathspec.cr
agate/proxy.cr
agate/rebase.cr
agate/refdb.cr
agate/reference_collection.cr
agate/reflog.cr
agate/refs.cr
agate/refspec.cr
agate/remote.cr
agate/remote_options.cr
agate/repository.cr
agate/reset.cr
agate/revert.cr
agate/revparse.cr
agate/signature.cr
agate/stash.cr
agate/status.cr
agate/strarray.cr
agate/submodule.cr
agate/tag.cr
agate/trace.cr
agate/transaction.cr
agate/transport.cr
agate/tree.cr
agate/walker.cr
agate/workdir.cr
agate/worktree.cr
Constant Summary
-
LIBGIT2_AT_LEAST_1_9 =
true -
LIBGIT2_VERSION =
{{ (`pkg-config --modversion libgit2 2>/dev/null || echo \"0.0.0\"`).strip.stringify }} -
Detect libgit2 version at compile time via pkg-config. Used to select the correct API names for version-dependent functions.
LIBGIT2_VERSION is a string like "1.9.2". Use the LIBGIT2_AT_LEAST_1_9 compile-time constant for API selection.
-
VERSION =
"0.1.1"
Class Method Summary
-
.features
Returns the compile-time feature flags of libgit2.
-
.hex_to_raw(hex : String) : Bytes
Converts a hex OID string to raw bytes.
-
.init
Initializes the libgit2 library.
- .initializations
-
.prettify_message(message : String, strip_comments : Bool = true, comment_char : Char = '#') : String
Cleans up a commit message: strips comments, trailing whitespace, and ensures a single trailing newline.
-
.raw_to_hex(raw : Bytes) : String
Converts raw bytes to a hex OID string.
-
.repository?(path = ".") : Bool
Returns true if the given path is a repository.
-
.shutdown
Decrements the libgit2 initialization count.
-
.trace(level : TraceLevel, &callback : TraceLevel, String -> ) : Nil
Sets the libgit2 tracing level and callback.
-
.trace_off : Nil
Disables tracing.
-
.valid_full_oid?(hex : String) : Bool
Module-level convenience for OID validation.
-
.version
Returns the libgit2 version as a SemanticVersion.
Class Method Detail
Cleans up a commit message: strips comments, trailing whitespace, and ensures a single trailing newline.
Agate.prettify_message("hello \n\n") # => "hello\n"
Sets the libgit2 tracing level and callback.
Agate.trace(TraceLevel::Info) do |level, message|
puts "[git2 #{level}] #{message}"
end
Note: The callback is stored in a class variable and must not be
garbage collected while tracing is active. Call
Agate.trace(TraceLevel::None) to disable tracing.