class Git::Status::StatusFile
subclass that does heavy lifting
Attributes
mode_index[RW]
@!attribute [r] #mode_index
The mode of the file in the index @return [String] @example 100644
mode_repo[RW]
@!attribute [r] #mode_repo
The mode of the file in the repo @return [String] @example 100644
path[RW]
@!attribute [r] path
The path of the file relative to the project root directory @return [String]
sha_index[RW]
@!attribute [r] #sha_index
The sha of the file in the index @return [String] @example 123456
sha_repo[RW]
@!attribute [r] #sha_repo
The sha of the file in the repo @return [String] @example 123456
stage[RW]
@!attribute [r] stage
The stage of the file * '0': the unmerged state * '1': the common ancestor (or original) version * '2': "our version" from the current branch head * '3': "their version" from the other branch head @return [String]
type[RW]
@!attribute [r] type
The type of change * 'M': modified * 'A': added * 'D': deleted * nil: ??? @return [String]
untracked[RW]
@!attribute [r] untracked
Whether the file is untracked @return [Boolean]
Public Class Methods
new(base, hash)
click to toggle source
# File lib/git/status.rb, line 192 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
# File lib/git/status.rb, line 204 def blob(type = :index) if type == :repo @base.object(@sha_repo) else begin @base.object(@sha_index) rescue @base.object(@sha_repo) end end end