Implements the Git.Command behaviour for git init.
Supports initializing a new repository at an optional path, with optional
--bare and --initial-branch options.
Summary
Types
Functions
Returns the argument list for git init.
When :bare is true, passes --bare. When :initial_branch is set,
passes --initial-branch=<name> (useful because CI runners often have no
init.defaultBranch configured). When :path is set, appends it as the
final argument.
Examples
iex> Git.Commands.Init.args(%Git.Commands.Init{})
["init"]
iex> Git.Commands.Init.args(%Git.Commands.Init{bare: true})
["init", "--bare"]
iex> Git.Commands.Init.args(%Git.Commands.Init{initial_branch: "main"})
["init", "--initial-branch=main"]
iex> Git.Commands.Init.args(%Git.Commands.Init{path: "/tmp/repo"})
["init", "/tmp/repo"]
iex> Git.Commands.Init.args(%Git.Commands.Init{bare: true, initial_branch: "main", path: "/tmp/repo.git"})
["init", "--bare", "--initial-branch=main", "/tmp/repo.git"]
@spec parse_output(String.t(), non_neg_integer()) :: {:ok, :done} | {:error, {String.t(), non_neg_integer()}}
Parses the output of git init.
On success (exit code 0), returns {:ok, :done}. On failure, returns
{:error, {stdout, exit_code}}.