Composer.Git (composer v0.2.0)

Copy Markdown View Source

Git support for mix composer.recipe.run: the pre-flight status check, the commit message, and the commit itself.

Summary

Functions

Stages everything and commits with the message in message_file.

Builds the commit message for a run of recipe.

Reports the state of the work tree containing dir.

Functions

commit(dir, message_file)

@spec commit(Path.t(), Path.t()) ::
  {:ok, String.t()} | :nothing_to_commit | {:error, String.t()}

Stages everything and commits with the message in message_file.

Returns {:ok, output} on a commit, :nothing_to_commit when the tree had no changes, or {:error, output}.

message(recipe, map, entries)

@spec message(String.t(), %{config: Path.t(), flags: [atom()]}, [
  Composer.Resolver.entry()
]) ::
  String.t()

Builds the commit message for a run of recipe.

info carries :config (the local config directory) and :flags (the flag names that were passed). The subject stays under 72 characters; the body is plain lines, numbered steps, no bullets.

status(dir)

@spec status(Path.t()) :: :not_a_repo | :clean | :dirty

Reports the state of the work tree containing dir.

Untracked files count as dirty; ignored files do not. A missing git binary is reported as :not_a_repo.