]> git.armaanb.net Git - stagit.git/commitdiff
optimization: suppress large diffs
authorHiltjo Posthuma <hiltjo@codemadness.org>
Sat, 30 Apr 2016 10:00:33 +0000 (12:00 +0200)
committerHiltjo Posthuma <hiltjo@codemadness.org>
Sat, 30 Apr 2016 10:47:06 +0000 (12:47 +0200)
the values are arbitrary, these can be tweaked later if needed.

stagit.c

index aea474718c567af173d5ad654826f64e29007e16..4664fdc953f71779b18376c9f84596bd0da4f236 100644 (file)
--- 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++) {