mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Bust that cache
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
require 'linguist/lazy_blob'
|
||||
require 'rugged'
|
||||
|
||||
require 'pry'
|
||||
module Linguist
|
||||
# A Repository is an abstraction of a Grit::Repo or a basic file
|
||||
# system tree. It holds a list of paths pointing to Blobish objects.
|
||||
@@ -128,13 +128,23 @@ module Linguist
|
||||
protected
|
||||
|
||||
def compute_stats(old_commit_oid, cache = nil)
|
||||
file_map = cache ? cache.dup : {}
|
||||
old_tree = old_commit_oid && Rugged::Commit.lookup(repository, old_commit_oid).tree
|
||||
|
||||
read_index
|
||||
|
||||
diff = Rugged::Tree.diff(repository, old_tree, current_tree)
|
||||
|
||||
# Clear file map and fetch full diff if any .gitattributes files are changed
|
||||
if cache && diff.each_delta.any? { |delta| File.basename(delta.new_file[:path]) == ".gitattributes" }
|
||||
diff = Rugged::Tree.diff(repository, old_tree = nil, current_tree)
|
||||
file_map = {}
|
||||
else
|
||||
file_map = cache ? cache.dup : {}
|
||||
end
|
||||
|
||||
# TODO - do we need to re-read the index?
|
||||
# read_index
|
||||
|
||||
diff.each_delta do |delta|
|
||||
old = delta.old_file[:path]
|
||||
new = delta.new_file[:path]
|
||||
|
||||
Reference in New Issue
Block a user