Git.StashEntry (git v0.4.0)

Copy Markdown View Source

Parsed representation of a git stash entry.

Contains the stash index, the branch the stash was created on, and the stash message.

Summary

Functions

Parses the output of git stash list into a list of Git.StashEntry structs.

Types

t()

@type t() :: %Git.StashEntry{
  branch: String.t() | nil,
  index: non_neg_integer(),
  message: String.t()
}

Functions

parse(output)

@spec parse(String.t()) :: [t()]

Parses the output of git stash list into a list of Git.StashEntry structs.

Each line has the form:

stash@{0}: On main: my changes
stash@{1}: WIP on main: abc1234 commit message

Examples

iex> Git.StashEntry.parse("stash@{0}: On main: my changes\n")
[%Git.StashEntry{index: 0, branch: "main", message: "my changes"}]

iex> Git.StashEntry.parse("")
[]