lib/git_store/tree.rb
def load_from_disk
      dir = File.join(store.path, self.path)
      entries = Dir.entries(dir) - ['.', '..']

      @table = entries.inject({}) do |hash, name|
        if name[-1, 1] != '~' && name[0, 1] != '.'
          path = "#{dir}/#{name}"
          stat = File.stat(path)
          mode = '%o' % stat.mode
          klass = stat.directory? ? Tree : Blob
          
          child = table[name] ||= klass.new(store)
          child.set(nil, mode, child_path(name), data)
          child.load_from_disk
          
          hash[name] = child
        end        
        hash
      end
    end
# Load this tree from a real directory instead of a repository.
Load this tree from a real directory instead of a repository.
Load this tree from a real directory instead of a repository .
def load_from_disk
      dir = File.join(store.path, self.path)
      entries = Dir.entries(dir) - ['.', '..']
      @table = entries.inject({}) do |hash, name|
        if name[-1, 1] != '~' && name[0, 1] != '.'
          path = "#{dir}/#{name}"
          stat = File.stat(path)
          mode = '%o' % stat.mode
          klass = stat.directory? ? Tree : Blob
          child = table[name] ||= klass.new(store)
          child.set(nil, mode, child_path(name), data)
          child.load_from_disk
          hash[name] = child
        end        
        hash
      end
    end
def load_from_disk dir = File . join ( store . path , self . path ) entries = Dir . entries ( dir ) - [ '.' , '..' ] @table = entries . inject ( { } ) do | hash , name | if name [ - 1 , 1 ] != '~' && name [ 0 , 1 ] != '.' path = "#{dir}/#{name}" stat = File . stat ( path ) mode = '%o' % stat . mode klass = stat . directory? ? Tree : Blob child = table [ name ] ||= klass . new ( store ) child . set ( nil , mode , child_path ( name ) , data ) child . load_from_disk hash [ name ] = child end hash end end
Load this tree from a real directory instead of a repository.
Load this tree from a real directory instead of a repository .