Class: Rfix::CLI::Command::All

Inherits:
Base
  • Object
show all
Defined in:
lib/rfix/cli/command/all.rb

Instance Method Summary collapse

Methods included from Log

prompt, say, say!

Instance Method Details

#call(**params) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/rfix/cli/command/all.rb', line 7

def call(**params)
  walker = Rugged::Walker.new(Rugged::Repository.discover)
  walker.sorting(Rugged::SORT_TOPO | Rugged::SORT_REVERSE)
  walker.push("HEAD")

  unless oid = walker.each_oid(limit: 1).first
    raise Error, "Repository contains no commits"
  end

  define(Rfix::Branch::Reference.new(name: oid), **params)
end