summaryrefslogtreecommitdiff
path: root/stagit.c
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2016-04-30 12:00:33 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2016-04-30 12:47:06 +0200
commit7067223104f028ba85deaa1996c892ddfb8230dd (patch)
tree78af5a1943843523f2cb00221414744721ad7470 /stagit.c
parent914880f31b04222fa2815f4f35543b72f881d5e4 (diff)
optimization: suppress large diffs
the values are arbitrary, these can be tweaked later if needed.
Diffstat (limited to 'stagit.c')
-rw-r--r--stagit.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/stagit.c b/stagit.c
index aea4747..4664fdc 100644
--- a/stagit.c
+++ b/stagit.c
@@ -432,6 +432,14 @@ printshowfile(FILE *fp, struct commitinfo *ci)
if (!ci->deltas)
return;
+ if (ci->filecount > 1000 ||
+ ci->ndeltas > 1000 ||
+ ci->addcount > 100000 ||
+ ci->delcount > 100000) {
+ fprintf(fp, "(diff is too large, output suppressed)");
+ return;
+ }
+
/* diff stat */
fputs("<b>Diffstat:</b>\n<table>", fp);
for (i = 0; i < ci->ndeltas; i++) {