Skip to content

Commit d93bd1a

Browse files
authored
fix: git storage - 'import everything' feature restored (#4559) (#4572)
1 parent cd98c97 commit d93bd1a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

server/modules/storage/git/storage.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ module.exports = {
181181
if (!item.binary && contentType) {
182182
// -> Page
183183

184-
if (fileExists && item.relPath !== item.oldPath) {
184+
if (fileExists && !item.importAll && item.relPath !== item.oldPath) {
185185
// Page was renamed by git, so rename in DB
186186
WIKI.logger.info(`(STORAGE/GIT) Page marked as renamed: from ${item.oldPath} to ${item.relPath}`)
187187

@@ -195,7 +195,7 @@ module.exports = {
195195
destinationLocale: contentPath.locale,
196196
skipStorage: true
197197
})
198-
} else if (!fileExists && item.deletions > 0 && item.insertions === 0) {
198+
} else if (!fileExists && !item.importAll && item.deletions > 0 && item.insertions === 0) {
199199
// Page was deleted by git, can safely mark as deleted in DB
200200
WIKI.logger.info(`(STORAGE/GIT) Page marked as deleted: ${item.relPath}`)
201201

@@ -224,7 +224,7 @@ module.exports = {
224224
} else {
225225
// -> Asset
226226

227-
if (fileExists && ((item.before === item.after) || (item.deletions === 0 && item.insertions === 0))) {
227+
if (fileExists && !item.importAll && ((item.before === item.after) || (item.deletions === 0 && item.insertions === 0))) {
228228
// Asset was renamed by git, so rename in DB
229229
WIKI.logger.info(`(STORAGE/GIT) Asset marked as renamed: from ${item.oldPath} to ${item.relPath}`)
230230

@@ -240,7 +240,7 @@ module.exports = {
240240
WIKI.logger.info(`(STORAGE/GIT) Asset was not found in the DB, nothing to rename: ${item.relPath}`)
241241
}
242242
continue
243-
} else if (!fileExists && ((item.before > 0 && item.after === 0) || (item.deletions > 0 && item.insertions === 0))) {
243+
} else if (!fileExists && !item.importAll && ((item.before > 0 && item.after === 0) || (item.deletions > 0 && item.insertions === 0))) {
244244
// Asset was deleted by git, can safely mark as deleted in DB
245245
WIKI.logger.info(`(STORAGE/GIT) Asset marked as deleted: ${item.relPath}`)
246246

@@ -427,7 +427,8 @@ module.exports = {
427427
relPath,
428428
file,
429429
deletions: 0,
430-
insertions: 0
430+
insertions: 0,
431+
importAll: true
431432
}], rootUser)
432433
}
433434
cb()

0 commit comments

Comments
 (0)