Skip to content
Permalink
Browse files
forge: diff for GitLab commits can be empty
Reviewed-by: rwestberg
  • Loading branch information
edvbld committed Oct 30, 2020
1 parent daa3c93 commit b4bc1918321e8416d5fb9526e34704dd501aa2fb
Showing with 4 additions and 2 deletions.
  1. +4 −2 forge/src/main/java/org/openjdk/skara/forge/gitlab/GitLabRepository.java
@@ -441,8 +441,10 @@ Diff toDiff(Hash from, Hash to, JSONValue o) {
targetFileType = FileType.fromOctal(file.get("b_mode").asString());
}

var diff = file.get("diff").asString().split("\n");
var hunks = UnifiedDiffParser.parseSingleFileDiff(diff);
var diff = file.get("diff").asString();
var hunks = diff.isEmpty() ?
new ArrayList<Hunk>() :
UnifiedDiffParser.parseSingleFileDiff(diff.split("\n"));

patches.add(new TextualPatch(sourcePath, sourceFileType, Hash.zero(),
targetPath, targetFileType, Hash.zero(),

1 comment on commit b4bc191

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on b4bc191 Oct 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.