mirror of https://codeberg.org/gitnex/GitNex.git
Fix diff parsing and run unit tests (#1190)
Closes https://codeberg.org/gitnex/GitNex/issues/1167 The regex didn't match if the raw string starts with a `+` or `-`. Co-authored-by: qwerty287 <ndev@web.de> Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1190 Reviewed-by: M M Arif <mmarif@noreply.codeberg.org> Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org> Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
This commit is contained in:
parent
a7d9918b67
commit
f310f9f8e6
|
@ -13,3 +13,8 @@ pipeline:
|
|||
settings:
|
||||
file_pattern: "*.java"
|
||||
path: "app/"
|
||||
|
||||
test:
|
||||
image: alvrme/alpine-android:android-31-jdk11
|
||||
commands:
|
||||
- ./gradlew test
|
||||
|
|
|
@ -43,6 +43,12 @@ public class ParseDiff {
|
|||
Matcher rmMatcher = rmPattern.matcher(raw);
|
||||
Matcher addMatcher = addPattern.matcher(raw);
|
||||
|
||||
if(raw.startsWith("+")) {
|
||||
add++;
|
||||
}
|
||||
else if(raw.startsWith("-")) {
|
||||
rm++;
|
||||
}
|
||||
while(rmMatcher.find())
|
||||
rm++;
|
||||
while(addMatcher.find())
|
||||
|
|
Loading…
Reference in New Issue