module Git

Overview

Git provides a wrapper around git, backed by libgit2 (via Agate) rather than shelling out to the git binary. This avoids a subshell per call and lets the app be built as a static binary without requiring git to be on PATH at runtime.

Extended Modules

Defined in:

git.cr

Instance Method Summary

Instance Method Detail

def changelog(tag : String, ref = "HEAD") : String | Nil #

Generates a Markdown changelog between a previous tag and a ref.


[View source]
def config(name : String, key : String) : String | Nil #

Reads a git config value under a "." key, using the normal local/global/system config search order (like git config <name>.<key>).


[View source]
def log(range : String, format = "%s") : Array(String) #

Returns a changelog of commit subjects between two refs.


[View source]
def previous_tag(ref = "HEAD") : String | Nil #

Returns the tag before the given ref, or nil.


[View source]
def remotes : Enumerable(Remote) #

Returns the remotes of the repository containing the current directory (searching upward, like git itself does).


[View source]
def toplevel(path = ".") : Path | Nil #

Returns the top-level working directory of the git repository containing path, or nil if path isn't inside a git repository (searches upward, like git itself does). Returns nil for bare repositories too.


[View source]