Skip to content

DiffSummary list of files empty when renaming a binary #885

@EricFromCanada

Description

@EricFromCanada

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions