Skip to content

Commit

Permalink
fix: fix ArrayIndexOutOfBoundsException issue when need-remove-commit…
Browse files Browse the repository at this point in the history
…-id count larger than 20
  • Loading branch information
Jacksgong committed Oct 18, 2018
1 parent 1b69f5d commit 9b6e587
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/groovy/com/liulishuo/okcheck/util/ChangeFile.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,10 @@ class ChangeFile {

backupFile.createNewFile()

if (backupCommitIdList.size() + newCommitIds.size() >= 20) {
int needRemoveSize = backupCommitIdList.size() + newCommitIds.size() - 20
int maxRemainCount = Math.max(30, newCommitIds.size())

if (backupCommitIdList.size() + newCommitIds.size() >= maxRemainCount) {
int needRemoveSize = backupCommitIdList.size() + newCommitIds.size() - maxRemainCount

Util.printLog("will delete $needRemoveSize from origin count ${backupCommitIdList.size()} because count of new insert ${newCommitIds.size()}")

Expand Down

0 comments on commit 9b6e587

Please sign in to comment.