Nixinova / LinguistJS

Analyse and list all languages used in a folder. Implementation of and powered by GitHub's Linguist.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Attributes wildcards do not match into subfolders

Nixinova opened this issue · comments

When parsing gitattributes files, **/*.ext is treated differently from *.ext.
*.ext is treated the same as ./*.ext while **/*.ext is the one that matches into subfolders.
GitHub Linguist treats these the same.


Using a .gitattributes of *.ext linguist-language=Lang:`

  1. File structure of .gitattributes, file.ext.
    Result: file classified as Lang.
  2. File structure of .gitattributes, folder/file.ext.
    Result: under 'Unknown files and extensions'.

Running with versions 2.4.0 vs 2.4.1 2.4.0...2.4.1

Relevant changes in v 2.4.1:

- "glob-to-regexp": "~0.4.1",
+ "ignore": "^5.2.0",
Output difference
>npx linguist-js@2.4.0 -a
Need to install the following packages:
  linguist-js@2.4.0
Ok to proceed? (y) y

 Analysed 1,633 B from 1 files with linguist-js

 Language analysis results:
   1. █ Less                     100.00%      1,633 B
 Total: 1,633 B

>npx linguist-js@2.4.1 -a
Need to install the following packages:
  linguist-js@2.4.1
Ok to proceed? (y) y

 Analysed 1,633 B from 1 files with linguist-js

 Language analysis results:
  None
 Total: 0 B

 Unknown files and extensions:
  '*.ext': 1,633 B
 Total: 1,633 B

This is because *.ext whatever is parsed into overridesArray as /*.ext - a qualified path