gip-remote 1.2.6 → 1.2.7
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/index.js +19 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -210,9 +210,26 @@ class Remote extends ReadyResource {
|
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
-
// 4b. Insert file records
|
|
214
|
-
//
|
|
213
|
+
// 4b. Insert/update file records — but ONLY for paths whose blob or mode
|
|
214
|
+
// actually changed. Earlier versions blindly upserted every file in
|
|
215
|
+
// the new tree on every push, which overwrote the commit metadata of
|
|
216
|
+
// untouched files with HEAD's author/message/timestamp. The visible
|
|
217
|
+
// symptom: a tree view shows every file as "last modified by the
|
|
218
|
+
// latest commit", so per-file timestamps become useless.
|
|
219
|
+
//
|
|
220
|
+
// Skipping unchanged rows preserves the metadata of the commit that
|
|
221
|
+
// last *actually* modified the file. New paths and modified paths
|
|
222
|
+
// still take the current commit's metadata as before.
|
|
215
223
|
for (const file of files) {
|
|
224
|
+
const existing = await this._db.get('@gip/files', {
|
|
225
|
+
branch: refName,
|
|
226
|
+
path: file.path
|
|
227
|
+
})
|
|
228
|
+
if (existing && existing.oid === file.oid && existing.mode === file.mode) {
|
|
229
|
+
// Same blob, same mode → file is unchanged in this commit. Leave
|
|
230
|
+
// the existing row untouched so its commit metadata stays accurate.
|
|
231
|
+
continue
|
|
232
|
+
}
|
|
216
233
|
await this._db.insert('@gip/files', {
|
|
217
234
|
branch: refName,
|
|
218
235
|
path: file.path,
|