Method: ChkBuild::Build#git_parse_status

Defined in:
lib/chkbuild/scm/git.rb

#git_parse_status(f) ⇒ Object



167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/chkbuild/scm/git.rb', line 167

def git_parse_status(f)
  h = {}
  f.each_line("\0") {|line|
    # <mode> SP <type> SP <object> TAB <file>\0
    # 100644 blob 9518934185ea26856cf1bcdf75f7cc51fcd82534    core/array/allocate_spec.rb
    if /\A\d+ [^ ]+ ([0-9a-fA-F]+)\t([^\0]+)\0\z/ =~ line
      rev = $1
      path = $2
      h[path] = rev
    end
  }
  h
end