diff options
Diffstat (limited to 'source/shared.c')
| -rw-r--r-- | source/shared.c | 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 6 insertions, 3 deletions
diff --git a/source/shared.c b/source/shared.c index 9065693..3191742 100644 --- a/source/shared.c +++ b/source/shared.c @@ -410,9 +410,7 @@ int cgit_diff_files(const struct object_id *old_oid, const struct object_id *new *old_size = old_bytes; *new_size = new_bytes; - if (ctx.cfg.max_blob_size && - (old_bytes / 1024 > (unsigned long)ctx.cfg.max_blob_size || - new_bytes / 1024 > (unsigned long)ctx.cfg.max_blob_size)) { + if (cgit_blob_too_large(old_bytes) || cgit_blob_too_large(new_bytes)) { *binary = 1; return 0; } @@ -450,6 +448,11 @@ int cgit_diff_files(const struct object_id *old_oid, const struct object_id *new return 0; } +int cgit_blob_too_large(unsigned long size) +{ + return ctx.cfg.max_blob_size && size / 1024 > (unsigned long)ctx.cfg.max_blob_size; +} + void cgit_diff_limit_path(struct diff_options *opt, const char *prefix) { struct pathspec_item *item; |
