diff options
| -rw-r--r-- | source/ui-diff.c | 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 9 insertions, 7 deletions
diff --git a/source/ui-diff.c b/source/ui-diff.c index b34f7b3..ab40566 100644 --- a/source/ui-diff.c +++ b/source/ui-diff.c @@ -424,11 +424,15 @@ void cgit_print_diff(const char *new_rev, const char *old_rev, const struct object_id *old_tree_oid, *new_tree_oid; diff_type difftype; - /* - * If "follow" is set then the diff machinery needs to examine the - * entire commit to detect renames so we must limit the paths in our - * own callbacks and not pass the prefix to the diff machinery. - */ + // A path-limited diff is naturally bounded, so the size caps only + // apply to a whole-commit diff. Decide that from the caller's prefix + // before the follow logic rewrites it to "", otherwise follow=1 + // silently disables the caps. + cap_diffs = !prefix; + + // If "follow" is set then the diff machinery needs to examine the + // entire commit to detect renames so we must limit the paths in our + // own callbacks and not pass the prefix to the diff machinery. if (ctx.qry.follow && ctx.repo->enable_follow_links) { current_prefix = prefix; prefix = ""; @@ -436,8 +440,6 @@ void cgit_print_diff(const char *new_rev, const char *old_rev, current_prefix = NULL; } - cap_diffs = !prefix && !current_prefix; - if (!new_rev) new_rev = ctx.qry.head; if (repo_get_oid(the_repository, new_rev, new_rev_oid)) { |
