From 82a9e6756f35294825f2fde9e289e5aedbd3bade Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Wed, 13 Sep 2023 22:31:08 -0300 Subject: [PATCH] fix(conflicter): adjust diff message. --- workspaces/conflicter/src/conflicter.ts | 27 +++++++++++++++---------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/workspaces/conflicter/src/conflicter.ts b/workspaces/conflicter/src/conflicter.ts index 5e3470b..42fe101 100644 --- a/workspaces/conflicter/src/conflicter.ts +++ b/workspaces/conflicter/src/conflicter.ts @@ -169,15 +169,17 @@ export class Conflicter { ]); } - destAdapter.log.colored([ - { message: '\n' }, - { message: 'removed', color: 'removed' }, - { message: '' }, - { message: 'added', color: 'added' }, - { message: '\n\n' }, - ...messages.flat(), - { message: '\n\n' }, - ]); + if (messages) { + destAdapter.log.colored([ + { message: '\n' }, + { message: 'removed', color: 'removed' }, + { message: '' }, + { message: 'added', color: 'added' }, + { message: '\n\n' }, + ...messages.flat(), + { message: '\n\n' }, + ]); + } } /** @@ -202,7 +204,7 @@ export class Conflicter { } if (stat?.mode && diskStat.mode !== stat.mode) { - file.fileModeChanges = [Number.parseInt(stat.mode.toString(8), 10), Number.parseInt(diskStat.mode.toString(8), 10)]; + file.fileModeChanges = [Number.parseInt(diskStat.mode.toString(8), 10), Number.parseInt(stat.mode.toString(8), 10)]; } if (file.binary === undefined) { @@ -231,7 +233,10 @@ export class Conflicter { modified = (changes.length > 1 || changes[0].added || changes[0].removed) ?? false; } - file.conflicterChanges = changes; + if (modified) { + file.conflicterChanges = changes; + } + return Boolean(file.fileModeChanges) || modified; }