getting data output right

This commit is contained in:
Anton Romanov 2021-03-12 10:49:46 +04:00
parent 67d028d6cb
commit 0bf6947060

View File

@ -106,7 +106,7 @@ public class GitRepositoryService {
Changes changes = new Changes();
String[] strings = output.split("\n");
FileChange fileChange = new FileChange();
int stringsLength = strings.length;
int stringsLength = strings.length - 1;
for (int i = 0; i < strings.length; i++) {
while (i < stringsLength) {
Optional<String> maybeFileName = getFileName(strings[i]);
@ -129,11 +129,12 @@ public class GitRepositoryService {
i++;
}
}
if ((lineChange.getLineTo() != null && lineChange.getLineTo().isEmpty())
|| (lineChange.getLineFrom() != null && lineChange.getLineFrom().isEmpty())) {
if ((lineChange.getLineTo() != null) || (lineChange.getLineFrom() != null)
|| ((lineChange.getLineTo() != null) && (lineChange.getLineFrom() != null))) {
fileChange.getLineChanges().add(lineChange);
} else {
i++;
}
i++;
}
}
return changes;