From f090d0b9ff91d7af4b7713e9b053e59649ba57d7 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 25 Jul 2026 11:03:01 -1000 Subject: Add `max-patch-count` to bound the patch view --- source/ui-patch.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source/ui-patch.c') 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) { -- cgit v2.8.0