feat(GitRepo): Add glob-pattern exclusions for getUncommittedDiff and add minimatch; bump dependencies

This commit is contained in:
2025-11-04 01:26:54 +00:00
parent 5ba6c5370e
commit 9bacb2e548
6 changed files with 2394 additions and 2580 deletions

View File

@@ -1,5 +1,14 @@
# Changelog # Changelog
## 2025-11-04 - 3.3.0 - feat(GitRepo)
Add glob-pattern exclusions for getUncommittedDiff and add minimatch; bump dependencies
- getUncommittedDiff now supports glob patterns for excluded files via minimatch (skip files when filepath matches exact or glob pattern).
- Expose minimatch through plugins (ts/smartgit.plugins.ts) so plugin code can use glob matching consistently.
- Add minimatch to dependencies (minimatch ^10.1.1).
- Bump several dependencies: @push.rocks/smartenv to ^6.0.0, @push.rocks/smartfile to ^11.2.7, @push.rocks/smartshell to ^3.3.0, @push.rocks/smartstring to ^4.1.0, isomorphic-git to ^1.34.2.
- Bump devDependencies for build/test tooling: @git.zone/tsbuild ^2.7.1, @git.zone/tsrun ^1.6.2, @git.zone/tstest ^2.7.0.
## 2025-01-04 - 3.2.0 - feat(core) ## 2025-01-04 - 3.2.0 - feat(core)
Enhanced error handling, type safety, and documentation Enhanced error handling, type safety, and documentation

View File

@@ -32,21 +32,22 @@
}, },
"homepage": "https://code.foss.global/push.rocks/smartgit", "homepage": "https://code.foss.global/push.rocks/smartgit",
"dependencies": { "dependencies": {
"@push.rocks/smartenv": "^5.0.13", "@push.rocks/smartenv": "^6.0.0",
"@push.rocks/smartfile": "^11.2.5", "@push.rocks/smartfile": "^11.2.7",
"@push.rocks/smartpath": "^6.0.0", "@push.rocks/smartpath": "^6.0.0",
"@push.rocks/smartpromise": "^4.2.3", "@push.rocks/smartpromise": "^4.2.3",
"@push.rocks/smartshell": "^3.2.3", "@push.rocks/smartshell": "^3.3.0",
"@push.rocks/smartstring": "^4.0.15", "@push.rocks/smartstring": "^4.1.0",
"@push.rocks/smarttime": "^4.1.1", "@push.rocks/smarttime": "^4.1.1",
"@types/diff": "^8.0.0", "@types/diff": "^8.0.0",
"diff": "^8.0.2", "diff": "^8.0.2",
"isomorphic-git": "^1.32.2" "isomorphic-git": "^1.34.2",
"minimatch": "^10.1.1"
}, },
"devDependencies": { "devDependencies": {
"@git.zone/tsbuild": "^2.6.4", "@git.zone/tsbuild": "^2.7.1",
"@git.zone/tsrun": "^1.3.3", "@git.zone/tsrun": "^1.6.2",
"@git.zone/tstest": "^2.3.2" "@git.zone/tstest": "^2.7.0"
}, },
"private": false, "private": false,
"files": [ "files": [

4939
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@push.rocks/smartgit', name: '@push.rocks/smartgit',
version: '3.1.1', version: '3.3.0',
description: 'A smart wrapper for nodegit that simplifies Git operations in Node.js.' description: 'A smart wrapper for nodegit that simplifies Git operations in Node.js.'
} }

View File

@@ -122,8 +122,8 @@ export class GitRepo {
const diffs: string[] = []; const diffs: string[] = [];
for (const row of statusMatrix) { for (const row of statusMatrix) {
const [filepath, head, workdir] = row; const [filepath, head, workdir] = row;
if (excludeFiles.includes(filepath)) { if (excludeFiles.some(pattern => filepath === pattern || plugins.minimatch(filepath, pattern))) {
continue; // Skip excluded files continue; // Skip excluded files (supports exact matches and glob patterns)
} }
let headContent = ''; let headContent = '';

View File

@@ -15,5 +15,6 @@ export { smartenv, smartfile, smartpath, smartpromise, smartstring, smarttime };
// third party // third party
import * as diff from 'diff'; import * as diff from 'diff';
import isomorphicGit from 'isomorphic-git'; import isomorphicGit from 'isomorphic-git';
import { minimatch } from 'minimatch';
export { diff, isomorphicGit }; export { diff, isomorphicGit, minimatch };