Method: Git::Lib#ls_tree

Defined in:
lib/git/lib.rb

#ls_tree(sha, opts = {})

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
# File 'lib/git/lib.rb', line 656

def ls_tree(sha, opts = {})
  data = { 'blob' => {}, 'tree' => {}, 'commit' => {} }
  args = build_args(opts, LS_TREE_OPTION_MAP)

  args.unshift(sha)
  args << opts[:path] if opts[:path]

  command_lines('ls-tree', *args).each do |line|
    (info, filenm) = split_status_line(line)
    (mode, type, sha) = info.split
    data[type][filenm] = { mode: mode, sha: sha }
  end

  data
end