Represents the parsed result of a git commit command.
Contains the branch name, short commit hash, commit subject, and change statistics (files changed, insertions, deletions).
Summary
Functions
Parses the output of git commit into a Git.CommitResult struct.
Types
@type t() :: %Git.CommitResult{ branch: String.t(), deletions: non_neg_integer(), files_changed: non_neg_integer(), hash: String.t(), insertions: non_neg_integer(), subject: String.t() }
Functions
Parses the output of git commit into a Git.CommitResult struct.
The expected format is:
[branch hash] subject
N file(s) changed, N insertion(s)(+), N deletion(s)(-)Also handles root commits:
[branch (root-commit) hash] subjectExamples
iex> output = "[main abc1234] the commit message\n 1 file changed, 5 insertions(+), 2 deletions(-)\n"
iex> result = Git.CommitResult.parse(output)
iex> result.branch
"main"
iex> result.hash
"abc1234"
iex> result.subject
"the commit message"