Skip to content

Commit bb7b261

Browse files
committed
8gf8fg8f8f
1 parent 4f70f2f commit bb7b261

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/scanners/diffScan.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,25 @@ async function scanDiff({
1717
console.log(`commitSha ${commitSha}`);
1818

1919
const git = simpleGit(repoPath);
20-
20+
21+
const diffSummary = await git.diffSummary([`${commitSha}^..${commitSha}`]);
22+
23+
const changedFiles1 = diffSummary.files
24+
.map(file => file.file)
25+
.filter(file => fileExtensions.some(ext => file.endsWith(ext)))
26+
.filter(file => !excludePatterns.some(pattern => {
27+
const regexPattern = pattern
28+
.replace(/\*\*/g, '.*')
29+
.replace(/\*/g, '[^/]*')
30+
.replace(/\?/g, '[^/]');
31+
32+
return new RegExp(`^${regexPattern}$`).test(file);
33+
}))
34+
.map(file => path.resolve(repoPath, file));
35+
36+
console.log(`Found ${changedFiles1.length} changed files in commit ${commitSha}`);
37+
38+
2139
// Отримуємо змінені файли з останнього коміту
2240
const status = await git.status();
2341

0 commit comments

Comments
 (0)