mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f100dc91c2 | ||
|
|
fd9d63d605 | ||
|
|
5c21c35875 | ||
|
|
370d55fd74 | ||
|
|
8dd2ddcbf7 | ||
|
|
037857623d | ||
|
|
d7b19d577b | ||
|
|
c70048a3e2 | ||
|
|
b8a5e8505a | ||
|
|
3087d640a3 | ||
|
|
e87b89ab5b | ||
|
|
7aabc6a5ad | ||
|
|
5cc053694a | ||
|
|
653314448c |
@@ -34,7 +34,7 @@ The repository stats API, accessed through `#languages`, can be used on a direct
|
||||
|
||||
***API UPDATE***
|
||||
|
||||
Since [Version 3.0.0](https://github.com/github/linguist/releases/tag/v3.0.0) Linguist requires a git repository (in the form of a [Rugged::Repository](https://github.com/libgit2/rugged#repositories)) to be passed when initializing `Linguist::Repository`.
|
||||
Since [Version 3.0.0](https://github.com/github/linguist/releases/tag/v3.0.0) Linguist expects a git repository (in the form of a [Rugged::Repository](https://github.com/libgit2/rugged#repositories)) to be passed when initializing `Linguist::Repository`.
|
||||
|
||||
|
||||
```ruby
|
||||
|
||||
@@ -958,7 +958,7 @@ HTML+Django:
|
||||
|
||||
HTML+ERB:
|
||||
type: markup
|
||||
tm_scope: text.html.erb
|
||||
tm_scope: text.html.ruby
|
||||
group: HTML
|
||||
lexer: RHTML
|
||||
aliases:
|
||||
|
||||
@@ -128,13 +128,20 @@ 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
|
||||
|
||||
diff.each_delta do |delta|
|
||||
old = delta.old_file[:path]
|
||||
new = delta.new_file[:path]
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module Linguist
|
||||
VERSION = "3.3.1"
|
||||
VERSION = "3.4.0"
|
||||
end
|
||||
|
||||
@@ -68,6 +68,19 @@ class TestRepository < Test::Unit::TestCase
|
||||
assert !repo.breakdown_by_file["Ruby"].empty?
|
||||
end
|
||||
|
||||
def test_commit_with_git_attributes_data
|
||||
# Before we had any .gitattributes data
|
||||
old_commit = '4a017d9033f91b2776eb85275463f9613cc371ef'
|
||||
old_repo = linguist_repo(old_commit)
|
||||
|
||||
# With some .gitattributes data
|
||||
attr_commit = '7ee006cbcb2d7261f9e648510a684ee9ac64126b'
|
||||
# It's incremental but should bust the cache
|
||||
new_repo = Linguist::Repository.incremental(rugged_repository, attr_commit, old_commit, old_repo.cache)
|
||||
|
||||
assert new_repo.breakdown_by_file["Java"].include?("lib/linguist.rb")
|
||||
end
|
||||
|
||||
def test_linguist_override_vendored?
|
||||
attr_commit = '351c1cc8fd57340839bdb400d7812332af80e9bd'
|
||||
repo = linguist_repo(attr_commit).read_index
|
||||
|
||||
Reference in New Issue
Block a user