(diff, maxChangeLength)
| 85581 | fullGitMojiSpec, |
| 85582 | context |
| 85583 | ); |
| 85584 | return engine.generateCommitMessage(messages); |
| 85585 | } |
| 85586 | ); |
| 85587 | return commitMsgsFromFileLineDiffs; |
| 85588 | } |
| 85589 | function splitDiff(diff, maxChangeLength) { |
| 85590 | const lines = diff.split("\n"); |
| 85591 | const splitDiffs = []; |
| 85592 | let currentDiff = ""; |
| 85593 | if (maxChangeLength <= 0) { |
| 85594 | throw new Error(GenerateCommitMessageErrorEnum.outputTokensTooHigh); |
| 85595 | } |
| 85596 | for (let line of lines) { |
| 85597 | while (tokenCount(line) > maxChangeLength) { |
| 85598 | const subLine = line.substring(0, maxChangeLength); |
| 85599 | line = line.substring(maxChangeLength); |
| 85600 | splitDiffs.push(subLine); |
| 85601 | } |
| 85602 | if (tokenCount(currentDiff) + tokenCount("\n" + line) > maxChangeLength) { |
| 85603 | splitDiffs.push(currentDiff); |
| 85604 | currentDiff = line; |
| 85605 | } else { |
| 85606 | currentDiff += "\n" + line; |
| 85607 | } |
| 85608 | } |
| 85609 | if (currentDiff) { |
| 85610 | splitDiffs.push(currentDiff); |
no test coverage detected
searching dependent graphs…