stagit

optimization: suppress large diffs

the values are arbitrary, these can be tweaked later if needed.

Hiltjo Posthuma contact@arjunchoudhary.com

commit: 233b95a parent: 04d80a0
1 files changed, 8 insertions(+), 0 deletions(-)
Mstagit.c+8-0
M · stagit.c +8, -0
 1@@ -432,6 +432,14 @@ printshowfile(FILE *fp, struct commitinfo *ci)
 2 	if (!ci->deltas)
 3 		return;
 4 
 5+	if (ci->filecount > 1000   ||
 6+	    ci->ndeltas   > 1000   ||
 7+	    ci->addcount  > 100000 ||
 8+	    ci->delcount  > 100000) {
 9+		fprintf(fp, "(diff is too large, output suppressed)");
10+		return;
11+	}
12+
13 	/* diff stat */
14 	fputs("<b>Diffstat:</b>\n<table>", fp);
15 	for (i = 0; i < ci->ndeltas; i++) {