diff options
context:
space:
mode:
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Add `max-patch-count` to bound the patch view
Diffstat (limited to 'source/ui-patch.c')
-rw-r--r--source/ui-patch.c5
1 file changed, 5 insertions, 0 deletions
diff --git a/source/ui-patch.c b/source/ui-patch.c
index 9395769..6d8a8ad 100644
--- a/source/ui-patch.c
+++ b/source/ui-patch.c
@@ -91,6 +91,11 @@ void cgit_print_patch(const char *new_rev, const char *old_rev,
if (prefix)
rev.diffopt.stat_sep = fmt("(limited to '%s')\n\n", prefix);
setup_revisions(rev_argc, rev_argv, &rev, NULL);
+ // A single commit resolves to a parent..commit range, so this only
+ // bounds an explicit id/id2 range and keeps one request from
+ // emitting a patch for the entire history.
+ if (ctx.cfg.max_patch_count > 0)
+ rev.max_count = ctx.cfg.max_patch_count;
prepare_revision_walk(&rev);
while ((commit = get_revision(&rev)) != NULL) {