aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2021-05-23 21:48:45 +0200
committerHampusM <hampus@hampusmat.com>2021-05-23 21:48:45 +0200
commit7e828a5eb04afe476e596cf88000e53c2f93f45e (patch)
treec6bbb51c6129ac7f33794057473e8e530a634271
parent7c9dfd45ad041a1ee374618321684deda30a9fb4 (diff)
The commit-patch length-check also checks line length
-rw-r--r--api/git.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/api/git.js b/api/git.js
index 5c6f0d9..dad7cc6 100644
--- a/api/git.js
+++ b/api/git.js
@@ -157,9 +157,10 @@ async function getCommit(base_dir, repo_name, commit_oid)
const patch_end = (patch_header_data[0][patch_index + 1] !== undefined) ? patch_header_data[0][patch_index + 1] : all_patches.length - 1;
const patch_content = all_patches.slice(patch_start, patch_end);
- console.log(patch_content.length);
- if(patch_content.length > 5000) {
- console.log("Collapsed!");
+ const line_lengths = patch_content.map((line) => line.length).reduce((acc, length) => acc + length);
+
+ if(patch_content.length > 5000 || line_lengths > 5000) {
+ console.log("Too large!");
arr.push({
from: patch.oldFile().path(),