Method: Grit::GitRuby::Repository#quick_what_changed

Defined in:
lib/grit/git-ruby/repository.rb

#quick_what_changed(t1, t2, path, type) ⇒ Object



470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
# File 'lib/grit/git-ruby/repository.rb', line 470

def quick_what_changed(t1, t2, path, type)
  changed = []

  t1[type].each do |file, hsh|
    t2_file = t2[type][file] rescue nil
    full = File.join(path, file)
    if !t2_file
      changed << [full, 'added', hsh[:sha], nil]      # not in parent
    elsif (hsh[:sha] != t2_file[:sha])
      changed << [full, 'modified', hsh[:sha], t2_file[:sha]]   # file changed
    end
  end if t1

  t2[type].each do |file, hsh|
    if !t1 || !t1[type][file]
      changed << [File.join(path, file), 'removed', nil, hsh[:sha]]
    end
  end if t2

  changed
end