Class: Git::Lib

Inherits:
Object
  • Object
show all
Defined in:
lib/git-commits-analyzer/monkey-patch-git.rb

Instance Method Summary collapse

Instance Method Details

#ls_tree(sha) ⇒ Object


10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/git-commits-analyzer/monkey-patch-git.rb', line 10

def ls_tree(sha)
  # Add 'commit' to the list of valid types.
  #data = {'blob' => {}, 'tree' => {}}
  data = {'blob' => {}, 'tree' => {}, 'commit' => {}}

  command_lines('ls-tree', sha).each do |line|
    (info, filenm) = line.split("\t")
    (mode, type, sha) = info.split
    data[type][filenm] = {:mode => mode, :sha => sha}
  end

  data
end