pinokiod 5.0.11 → 5.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/server/index.js +30 -0
package/package.json
CHANGED
package/server/index.js
CHANGED
|
@@ -1398,6 +1398,23 @@ class Server {
|
|
|
1398
1398
|
let statusMatrix = await git.statusMatrix({ dir, fs })
|
|
1399
1399
|
statusMatrix = statusMatrix.filter(Boolean)
|
|
1400
1400
|
|
|
1401
|
+
let headOid = null
|
|
1402
|
+
const getHeadOid = async () => {
|
|
1403
|
+
if (headOid) return headOid
|
|
1404
|
+
headOid = await git.resolveRef({ fs, dir, ref: 'HEAD' })
|
|
1405
|
+
return headOid
|
|
1406
|
+
}
|
|
1407
|
+
const readNormalized = async (source, filepath) => {
|
|
1408
|
+
if (source === 'head') {
|
|
1409
|
+
const oid = await getHeadOid()
|
|
1410
|
+
const { blob } = await git.readBlob({ fs, dir, oid, filepath })
|
|
1411
|
+
return normalize(Buffer.from(blob).toString('utf8'))
|
|
1412
|
+
} else {
|
|
1413
|
+
const content = await fs.promises.readFile(path.join(dir, filepath), 'utf8')
|
|
1414
|
+
return normalize(content)
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1401
1418
|
const changes = []
|
|
1402
1419
|
for (const [filepath, head, workdir, stage] of statusMatrix) {
|
|
1403
1420
|
if (!shouldIncludePath(filepath)) {
|
|
@@ -1422,6 +1439,19 @@ class Server {
|
|
|
1422
1439
|
continue
|
|
1423
1440
|
}
|
|
1424
1441
|
|
|
1442
|
+
// Skip entries where HEAD and worktree match after normalization
|
|
1443
|
+
if (status && status.startsWith('modified')) {
|
|
1444
|
+
try {
|
|
1445
|
+
const headContent = await readNormalized('head', filepath)
|
|
1446
|
+
const worktreeContent = await readNormalized('worktree', filepath)
|
|
1447
|
+
if (headContent === worktreeContent) {
|
|
1448
|
+
continue
|
|
1449
|
+
}
|
|
1450
|
+
} catch (_) {
|
|
1451
|
+
// fall through if comparison fails
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1425
1455
|
const webpath = "/asset/" + path.relative(this.kernel.homedir, absolutePath)
|
|
1426
1456
|
|
|
1427
1457
|
changes.push({
|