mirror of
https://github.com/jimeh/build-emacs-for-macos.git
synced 2026-02-19 13:06:38 +00:00
wip: add commit-info command
This commit is contained in:
@@ -1,14 +1,27 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'json'
|
||||
require 'time'
|
||||
require 'yaml'
|
||||
|
||||
require_relative './errors'
|
||||
require_relative './common'
|
||||
|
||||
class Commit
|
||||
include Common
|
||||
|
||||
attr_reader :repo
|
||||
attr_reader :ref
|
||||
attr_reader :message
|
||||
attr_reader :sha
|
||||
attr_reader :time
|
||||
|
||||
def initialize(sha:, time:)
|
||||
def initialize(sha:, time:, repo: nil, ref: nil, message: nil)
|
||||
@sha = sha
|
||||
@time = time
|
||||
@repo = repo
|
||||
@ref = ref
|
||||
@message = message
|
||||
end
|
||||
|
||||
def sha_short
|
||||
@@ -17,9 +30,13 @@ class Commit
|
||||
|
||||
def to_hash
|
||||
{
|
||||
'repo' => repo,
|
||||
'ref' => ref,
|
||||
'sha' => sha,
|
||||
'sha_short' => sha_short,
|
||||
'time' => time
|
||||
'time' => time.utc,
|
||||
'timestamp' => time.utc.to_i,
|
||||
'message' => message
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user