Skip to content

Commit 7ad1f5c

Browse files
committed
Fix gitattributes wildcards not applying to subfolders
Gitattributes patterns like `*.ext` will now match all files with that pattern in all subfolders, instead of only in root. Resolves #17
1 parent f5d59a8 commit 7ad1f5c

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ async function analyse(input?: string | string[], opts: T.Options = {}): Promise
132132
forcedLang = overrideLang[0];
133133
}
134134
}
135-
const fullPath = relPath(folder) + '/' + path;
135+
const fullPath = paths.join(relPath(folder), path);
136136
overrides[fullPath] = forcedLang;
137137
}
138138
}

test/expected.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"files": {
3-
"count": 7,
4-
"bytes": 46,
3+
"count": 8,
4+
"bytes": 47,
55
"results": {
66
"~/al.al": "Perl",
77
"~/file.txt": "JavaScript",
@@ -14,10 +14,10 @@
1414
},
1515
"languages": {
1616
"count": 5,
17-
"bytes": 37,
17+
"bytes": 38,
1818
"results": {
1919
"Perl": { "type": "programming", "bytes": 0, "color": "#0298c3" },
20-
"JavaScript": { "type": "programming", "bytes": 22, "color": "#f1e05a" },
20+
"JavaScript": { "type": "programming", "bytes": 23, "color": "#f1e05a" },
2121
"Text": { "type": "prose", "bytes": 0 },
2222
"C++": { "type": "programming", "bytes": 15, "color": "#f34b7d" },
2323
"TOML": { "type": "data", "bytes": 0, "color": "#9c4221" }

test/samples/folder/file.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1

0 commit comments

Comments
 (0)