31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/rfix/collector.rb', line 31
def each(&block)
construct = lambda do |path, statuses|
File.call(basename: path, status: statuses, repository: repository)
end
statuses = Hash.new(EMPTY_ARRAY).tap do |statuses|
repository.status do |path, status|
statuses[path] = status
end
end
if repository.head_unborn?
statuses.each do |path, status|
(block << construct).call(path, status)
end
else
origin.diff_workdir(**OPTIONS.dup).tap do |diff|
diff.find_similar!(
renames_from_rewrites: true,
renames: true,
copies: true
)
end.each_delta do |delta|
delta.new_file.fetch(:path).then do |file_path|
(block << construct).call(file_path, statuses[file_path] + [delta.status])
end
end
end
end
|