class Git::Status::Git::Status::StatusFile

Represents a single file’s status in the git repository. Each instance holds information about a file’s state in the index and working tree.

Attributes

mode_index[R]
mode_repo[R]
path[R]
sha_index[R]
sha_repo[R]
stage[R]
type[R]
untracked[R]

Public Class Methods

new(base, hash) click to toggle source
# File lib/git/status.rb, line 94
def initialize(base, hash)
  @base       = base
  @path       = hash[:path]
  @type       = hash[:type]
  @stage      = hash[:stage]
  @mode_index = hash[:mode_index]
  @mode_repo  = hash[:mode_repo]
  @sha_index  = hash[:sha_index]
  @sha_repo   = hash[:sha_repo]
  @untracked  = hash[:untracked]
end

Public Instance Methods

blob(type = :index) click to toggle source

Returns a Git::Object::Blob for either the index or repo version of the file.

# File lib/git/status.rb, line 107
def blob(type = :index)
  sha = type == :repo ? sha_repo : (sha_index || sha_repo)
  @base.object(sha) if sha
end