33 lines
1.4 KiB
Markdown
33 lines
1.4 KiB
Markdown
# smartgit Project Hints
|
|
|
|
## Recent Fixes
|
|
|
|
### getUncommittedDiff() False Positives Fix (2025-11-04)
|
|
|
|
**Problem**:
|
|
- Method was reporting 1,883 diffs when only 1-2 files were actually modified
|
|
- Root cause: isomorphic-git's `statusMatrix()` reports files inside symlinked directories as "added" files
|
|
- Example: `ghost_local/current` → symlink to `ghost_local/versions/5.129.1` causes all 1,880+ files inside to be reported as changes
|
|
|
|
**Solution Implemented**:
|
|
1. **Symlink detection** (lines 160-184): For files reported as "added" (head=0, workdir≠0), try to read from HEAD anyway. If we get error "anticipated to be a tree but it is a blob", the parent path is a symlink - skip the file entirely.
|
|
|
|
2. **Content comparison** (lines 196-200): Before creating any diff, check if `headContent === workdirContent`. If identical, skip (catches permission/timestamp/line-ending false positives).
|
|
|
|
**Results**:
|
|
- Reduced false positives from 1,883 → 2 files (99.89% reduction)
|
|
- Output size: 59 MB → 2 KB (29,500x reduction)
|
|
- Only reports actual content changes
|
|
|
|
**Files Modified**:
|
|
- `ts/smartgit.classes.gitrepo.ts` lines 153-209
|
|
|
|
**Dependencies Added**:
|
|
- `minimatch` for glob pattern support in excludeFiles parameter
|
|
|
|
## Architecture Notes
|
|
|
|
- Main class: `Smartgit` (not `SmartGit` - lowercase 'g')
|
|
- Must call `await smartgit.init()` before use
|
|
- Repository methods: `createRepoByOpen()`, `createRepoByClone()`, `createRepoByInit()`
|