diff options
Diffstat (limited to 'source/ui-diff.c')
| -rw-r--r-- | source/ui-diff.c | 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 14 insertions, 19 deletions
diff --git a/source/ui-diff.c b/source/ui-diff.c index e08b096..3c7d8d2 100644 --- a/source/ui-diff.c +++ b/source/ui-diff.c @@ -17,12 +17,10 @@ #include "ui-shared.h" #include "ui-ssdiff.h" -// A file's body is collected while the walk still has that file open, because -// the stat table above it has to be printed first and rendering the bodies -// afterwards meant a second walk with its own rename detection and its own -// xdiff of every file. This bounds what one request may hold that way, so it -// is not something to configure, and once it is passed the collected bodies -// are dropped and that second walk happens after all. +// A file's body is collected while the walk still has that file open, +// since the stat table above it has to be printed first. This bounds what +// one request may hold that way. Past it the collected bodies are dropped +// and a second walk renders the page instead. #define BODY_BUDGET (8 * 1024 * 1024) // What a context of zero means once the diff runs, mirroring the fallback in @@ -81,9 +79,8 @@ static void release_bodies(void) /* * One bar segment of the per-file diffstat graph. The bar is a fixed-layout - * table whose row always spans 1000 columns, so a segment takes its share - * of the width through colspan rather than through an inline style, which - * a Content-Security-Policy would have to allow. + * table whose row always spans 1000 columns, so a segment takes its width + * through colspan rather than an inline style a CSP would have to allow. */ static void print_graph_cell(const char *class, int span) { @@ -168,9 +165,8 @@ static void print_fileinfo(struct fileinfo *info) } /* - * Counting is only half of what this does. It also renders each line, until - * max-diff-lines is passed and the rest of the file is dropped, which is why - * the two cannot be separated into a counting pass and a rendering one. + * Counting is only half of what this does. It also renders each line until + * max-diff-lines is passed, so the two cannot be split into separate passes. */ static void count_diff_lines(char *line, int len) { @@ -376,9 +372,9 @@ static void collect_body(struct diff_filepair *pair, struct fileinfo *item, render_suppressed = 0; if (S_ISGITLINK(pair->one->mode) || S_ISGITLINK(pair->two->mode)) { - // The stat has always counted what a diff of the pair produces - // rather than the two lines the body shows, so run that diff - // for the count alone. + // The stat counts what a diff of the pair produces rather + // than the two lines the body shows, so run that diff for + // the count alone. render_line_fn = NULL; cgit_diff_files(&pair->one->oid, &pair->two->oid, old_size, new_size, binary, 0, ctx.qry.ignorews, @@ -398,10 +394,9 @@ static void collect_body(struct diff_filepair *pair, struct fileinfo *item, cgit_ssdiff_footer(); if (render_suppressed) { - // Setting the length back would leave the buffer holding - // everything it grew to while rendering, which the budget below - // cannot see because it only counts what is kept, so rebuild it - // at the size actually kept. + // Setting the length back would keep the grown allocation, + // which the budget below cannot see because it only counts + // what is kept, so rebuild the buffer at the kept size. char *header_text = xmemdupz(body->buf, header_len); strbuf_release(body); |
