RFR: Handle trailing blank lines in commit message [v2]

Robin Westberg rwestberg at openjdk.java.net
Wed Dec 2 11:13:07 UTC 2020

On Tue, 1 Dec 2020 11:43:24 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> Robin Westberg has updated the pull request incrementally with one additional commit since the last revision:
>>   Trailing blank lines end up in "additional"
> vcs/src/main/java/org/openjdk/skara/vcs/openjdk/CommitMessageParsers.java line 121:
>> 119:                 if (i >= lines.size()) {
>> 120:                     break;
>> 121:                 }
> I guess I'm a little confused as to how this fixes the problem :/ Is it because `firstDelimiter` is false after the first line and then it adds a blank?
> Does it make sense to move the `i++` to the end of the while loop, and then increment it one time separately before the loop, so that the while loop condition can use the `i < lines.size()` condition, and no separate `if` is needed?

I agree that the code is a bit unintuitive, have had to look at it a few times.. :) But no, incrementing should only be done if we're at a blank line, so can't do it unconditionally outside of the loop..

I pushed a different version that is perhaps a bit more clear.


PR: https://git.openjdk.java.net/skara/pull/959

More information about the skara-dev mailing list