Sha256: efad3ce8d1dfe6efedfae127a8be77f97b8146a9e5f3410e25c9e97041a1d7f7

Contents?: true

Size: 705 Bytes

Versions: 1

Compression:

Stored size: 705 Bytes

Contents

# frozen_string_literal: true

require 'git_dump/path_object'
require 'git_dump/tree/base'
require 'git_dump/entry'

class GitDump
  # Interface to git tree
  class Tree < PathObject
    include Base

    attr_reader :sha
    def initialize(repo, dir, name, sha)
      super(repo, dir, name)
      @sha = sha
      @entries = read_entries
    end

  private

    def read_entries
      entries = {}
      repo.tree_entries(sha).each do |entry|
        entries[entry[:name]] = if entry[:type] == :tree
          self.class.new(repo, path, entry[:name], entry[:sha])
        else
          Entry.new(repo, path, entry[:name], entry[:sha], entry[:mode])
        end
      end
      entries
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
git_dump-0.1.1 lib/git_dump/tree.rb