Skip to content

Commit 1dc6e52

Browse files
misc: remove logging of empty lines in diff as this is a common occurrence
1 parent 229424e commit 1dc6e52

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

  • src/main/java/org/variantsync/diffdetective/variation/diff

src/main/java/org/variantsync/diffdetective/variation/diff/DiffType.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,10 @@ public static DiffType ofDiffLine(String line) {
142142
return ADD;
143143
} else if (line.startsWith(REM.symbol)) {
144144
return REM;
145-
} else if (line.startsWith(NON.symbol)) {
146-
return NON;
147-
} else if (line.isEmpty()) {
148-
// Treat empty lines as NON (i.e., unchanged) even though they are invalid in a diff, which expects at least
149-
// one character (i.e., one of the diff type characters: '+', '-', or ' ').
150-
// In contrast to other invalid cases handled by the 'else' branch, we log a warning instead of returning null,
151-
// because empty lines may be created by certain text editors, such as Intellij's internal editor that may
152-
// convert lines that only contain whitespace characters to empty lines upon save.
153-
Logger.warn("parsing an empty line");
145+
} else if (line.startsWith(NON.symbol) || line.isEmpty()) {
146+
// Diff lines should ideally have at least one character specifying a line's type (i.e., one of the diff
147+
// type characters: '+', '-', or ' '). However, this is not necessarily the case and unchanged lines may
148+
// be empty. We thus treat empty lines in a diff as unchanged (i.e., NON),
154149
return NON;
155150
} else {
156151
return null;

0 commit comments

Comments
 (0)