Class: Git::Lib

Inherits:
Object
  • Object
show all
Defined in:
lib/monkey_patches.rb

Instance Method Summary collapse

Instance Method Details

#ls_files(location = nil) ⇒ Object

Monkey patch ls_files until github.com/ruby-git/ruby-git/pull/320 is resolved



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/monkey_patches.rb', line 43

def ls_files(location=nil)
  location ||= '.'
  hsh = {}
  command_lines('ls-files', ['--stage', location]).each do |line|
    (info, file) = line.split("\t")
    (mode, sha, stage) = info.split
    file = eval(file) if file =~ /^\".*\"$/ # This takes care of quoted strings returned from git
    hsh[file] = {:path => file, :mode_index => mode, :sha_index => sha, :stage => stage}
  end
  hsh
end