quick_what_changed

in lib/grit/git-ruby/repository.rb [469:490]


      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]      
          elsif (hsh[:sha] != t2_file[:sha])
            changed << [full, 'modified', hsh[:sha], t2_file[:sha]]   
          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