|
@@ -1261,8 +1261,12 @@ export class ExtractionOrchestrator {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // Handle modified files — read + hash only these files
|
|
|
|
|
- for (const filePath of gitChanges.modified) {
|
|
|
|
|
|
|
+ // Handle modified + added files — read + hash only these. Untracked
|
|
|
|
|
+ // (`??`) files stay untracked in git even after we index them, so they
|
|
|
|
|
+ // can't be trusted as "new": re-hash and compare against the DB exactly
|
|
|
|
|
+ // like modified files. Otherwise every sync re-indexes them and status
|
|
|
|
|
+ // reports them as pending forever. (See issue #206.)
|
|
|
|
|
+ for (const filePath of [...gitChanges.modified, ...gitChanges.added]) {
|
|
|
const fullPath = path.join(this.rootDir, filePath);
|
|
const fullPath = path.join(this.rootDir, filePath);
|
|
|
let content: string;
|
|
let content: string;
|
|
|
try {
|
|
try {
|
|
@@ -1285,13 +1289,6 @@ export class ExtractionOrchestrator {
|
|
|
filesModified++;
|
|
filesModified++;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- // Handle added (untracked) files
|
|
|
|
|
- for (const filePath of gitChanges.added) {
|
|
|
|
|
- filesToIndex.push(filePath);
|
|
|
|
|
- changedFilePaths.push(filePath);
|
|
|
|
|
- filesAdded++;
|
|
|
|
|
- }
|
|
|
|
|
} else {
|
|
} else {
|
|
|
// === Fallback: full scan (non-git project or git failure) ===
|
|
// === Fallback: full scan (non-git project or git failure) ===
|
|
|
const currentFiles = new Set(scanDirectory(this.rootDir, this.config));
|
|
const currentFiles = new Set(scanDirectory(this.rootDir, this.config));
|
|
@@ -1395,8 +1392,11 @@ export class ExtractionOrchestrator {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // Modified files — read + hash only these, compare with DB
|
|
|
|
|
- for (const filePath of gitChanges.modified) {
|
|
|
|
|
|
|
+ // Modified + added files — read + hash, compare with DB. Untracked (`??`)
|
|
|
|
|
+ // files stay untracked in git even after indexing, so they must be
|
|
|
|
|
+ // hash-compared like modified files instead of always counting as added —
|
|
|
|
|
+ // otherwise status reports them as pending forever. (See issue #206.)
|
|
|
|
|
+ for (const filePath of [...gitChanges.modified, ...gitChanges.added]) {
|
|
|
const fullPath = path.join(this.rootDir, filePath);
|
|
const fullPath = path.join(this.rootDir, filePath);
|
|
|
let content: string;
|
|
let content: string;
|
|
|
try {
|
|
try {
|
|
@@ -1416,11 +1416,6 @@ export class ExtractionOrchestrator {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // Added (untracked) files
|
|
|
|
|
- for (const filePath of gitChanges.added) {
|
|
|
|
|
- added.push(filePath);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
return { added, modified, removed };
|
|
return { added, modified, removed };
|
|
|
}
|
|
}
|
|
|
|
|
|