git-js icon indicating copy to clipboard operation
git-js copied to clipboard

DiffSummary list of files empty when renaming a binary

Open EricFromCanada opened this issue 3 years ago • 0 comments

In a Wiki.js installation using Git for storage via git-js, if a binary is renamed in the underlying repository, the change isn't noticed because DiffSummary isn't populating the files attribute.

For example, when a binary is added:

$ git diff --stat -M HEAD^ HEAD
 uploads/image.png | Bin 0 -> 119296 bytes
 1 file changed, 0 insertions(+), 0 deletions(-)

the files attribute is populated:

diff: {"files":[{"file":"uploads/image.png","before":0,"after":119296,"binary":true}],"insertions":0,"deletions":0,"changed":1}

But when the binary is renamed:

$ git diff --stat -M HEAD^ HEAD
 uploads/{image.png => image-test.png} | Bin
 1 file changed, 0 insertions(+), 0 deletions(-)

the files attribute is empty:

diff: {"files":[],"insertions":0,"deletions":0,"changed":1}

Looking at parse-diff-summary.ts, it appears to only handle the first type of change.

EricFromCanada avatar Jan 06 '23 07:01 EricFromCanada