Class: Gitt::Commands::Log
- Inherits:
-
Object
- Object
- Gitt::Commands::Log
- Defined in:
- lib/gitt/commands/log.rb
Overview
A Git log command wrapper.
Constant Summary collapse
- KEY_MAP =
{ author_email: "%ae", author_name: "%an", authored_at: "%at", authored_relative_at: "%ar", body: "%b", committed_at: "%ct", committed_relative_at: "%cr", committer_email: "%ce", committer_name: "%cn", encoding: "%e", notes: "%N", raw: "%B", sha: "%H", signature: "%G?", fingerprint: "%GK", fingerprint_key: "%GF", subject: "%s", trailers: "%(trailers)" }.freeze
Instance Method Summary collapse
- #call ⇒ Object
- #index(*arguments) ⇒ Object
-
#initialize(shell: SHELL, key_map: KEY_MAP, parser: Parsers::Commit.new) ⇒ Log
constructor
A new instance of Log.
- #uncommitted(path) ⇒ Object
Constructor Details
Instance Method Details
#call ⇒ Object
38 |
# File 'lib/gitt/commands/log.rb', line 38 def call(*) = shell.call("log", *) |
#index(*arguments) ⇒ Object
40 41 42 43 44 45 |
# File 'lib/gitt/commands/log.rb', line 40 def index *arguments arguments.prepend("--shortstat", pretty_format) .then { |pretty_format| call(*pretty_format) } .fmap { |content| String(content).scrub("?") } .fmap { |entries| build_records entries } end |
#uncommitted(path) ⇒ Object
47 48 49 50 51 52 53 54 |
# File 'lib/gitt/commands/log.rb', line 47 def uncommitted path return Failure %(Invalid commit message path: "#{path}".) unless path.exist? shell.call("mktree") .bind { |raw_sha| shell.call "commit-tree", "-F", path.to_s, raw_sha.chomp } .bind { |sha| index "-1", sha.chomp } .fmap(&:first) end |