Xgit v0.1.0 Xgit.Core.PersonIdent

A combination of a person identity and time in git.

Link to this section Summary

Types

t()

The tuple of name, email, time, and time zone that specifies who wrote or committed something.

Time zone offset in minutes +/- from GMT.

Functions

Formats a timezone offset.

Parse a name line (e.g. author, committer, tagger) into a PersonIdent struct.

Sanitize the given string for use in an identity and append to output.

Formats the person identity for git storage.

Link to this section Types

Link to this type

t()
t() :: %Xgit.Core.PersonIdent{
  email: String.t(),
  name: String.t(),
  tz_offset: tz_offset(),
  when: integer()
}

The tuple of name, email, time, and time zone that specifies who wrote or committed something.

Struct Members

  • :name: (string) human-readable name of the author or committer
  • :email: (string) e-mail address for this person
  • :when: (integer) time in the Unix epoch in milliseconds
  • :tz_offset: (integer) time zone offset from GMT in minutes
Link to this type

tz_offset()
tz_offset() :: -720..840

Time zone offset in minutes +/- from GMT.

Link to this section Functions

Link to this function

format_timezone(offset)
format_timezone(offset :: tz_offset()) :: String.t()

Formats a timezone offset.

Link to this function

from_byte_list(b)
from_byte_list(b :: [byte()]) :: t() | nil

Parse a name line (e.g. author, committer, tagger) into a PersonIdent struct.

Parameters

b should be a charlist of an "author" or "committer" line pointing to the character after the header name and space.

The functions Xgit.Util.RawParseUtils.author/1 and Xgit.Util.RawParseUtils.committer/1 will return suitable charlists.

Return Value

Returns a PersonIdent struct or nil if the charlist did not point to a properly-formatted identity.

Link to this function

sanitized(s)
sanitized(s :: String.t()) :: String.t()

Sanitize the given string for use in an identity and append to output.

Trims whitespace from both ends and special characters \n < > that interfere with parsing; appends all other characters to the output.

Link to this function

to_external_string(person_ident)
to_external_string(person_ident :: t()) :: String.t()

Formats the person identity for git storage.