-rw-r--r-- | cmd.c | 2 | ||||
-rw-r--r-- | ui-commit.c | 2 | ||||
-rw-r--r-- | ui-patch.c | 6 | ||||
-rw-r--r-- | ui-patch.h | 2 | ||||
-rw-r--r-- | ui-shared.c | 4 | ||||
-rw-r--r-- | ui-shared.h | 2 |
6 files changed, 10 insertions, 8 deletions
@@ -85,17 +85,17 @@ static void objects_fn(struct cgit_context *ctx) static void repolist_fn(struct cgit_context *ctx) { cgit_print_repolist(); } static void patch_fn(struct cgit_context *ctx) { - cgit_print_patch(ctx->qry.sha1); + cgit_print_patch(ctx->qry.sha1, ctx->qry.path); } static void plain_fn(struct cgit_context *ctx) { cgit_print_plain(ctx); } static void refs_fn(struct cgit_context *ctx) diff --git a/ui-commit.c b/ui-commit.c index 2f4c6d4..b3a2063 100644 --- a/ui-commit.c +++ b/ui-commit.c @@ -55,17 +55,17 @@ void cgit_print_commit(char *hex, const char *prefix) } html("</td><td class='right'>"); cgit_print_date(info->committer_date, FMT_LONGDATE, ctx.cfg.local_time); html("</td></tr>\n"); html("<tr><th>commit</th><td colspan='2' class='sha1'>"); tmp = sha1_to_hex(commit->object.sha1); cgit_commit_link(tmp, NULL, NULL, ctx.qry.head, tmp, 0); html(" ("); - cgit_patch_link("patch", NULL, NULL, NULL, tmp); + cgit_patch_link("patch", NULL, NULL, NULL, tmp, prefix); html(") ("); if ((ctx.qry.ssdiff && !ctx.cfg.ssdiff) || (!ctx.qry.ssdiff && ctx.cfg.ssdiff)) cgit_commit_link("unidiff", NULL, NULL, ctx.qry.head, tmp, 1); else cgit_commit_link("side-by-side diff", NULL, NULL, ctx.qry.head, tmp, 1); html(")</td></tr>\n"); html("<tr><th>tree</th><td colspan='2' class='sha1'>"); tmp = xstrdup(hex); @@ -72,17 +72,17 @@ static void filepair_cb(struct diff_filepair *pair) } if (cgit_diff_files(pair->one->sha1, pair->two->sha1, &old_size, &new_size, &binary, print_line)) html("Error running diff"); if (binary) html("Binary files differ\n"); } -void cgit_print_patch(char *hex) +void cgit_print_patch(char *hex, const char *prefix) { struct commit *commit; struct commitinfo *info; unsigned char sha1[20], old_sha1[20]; char *patchname; if (!hex) hex = ctx.qry.head; @@ -117,13 +117,15 @@ void cgit_print_patch(char *hex) cgit_print_date(info->author_date, "%a, %d %b %Y %H:%M:%S %z%n", ctx.cfg.local_time); htmlf("Subject: %s\n\n", info->subject); if (info->msg && *info->msg) { htmlf("%s", info->msg); if (info->msg[strlen(info->msg) - 1] != '\n') html("\n"); } html("---\n"); - cgit_diff_tree(old_sha1, sha1, filepair_cb, NULL); + if (prefix) + htmlf("(limited to '%s')\n\n", prefix); + cgit_diff_tree(old_sha1, sha1, filepair_cb, prefix); html("--\n"); htmlf("cgit %s\n", CGIT_VERSION); cgit_free_commitinfo(info); } @@ -1,6 +1,6 @@ #ifndef UI_PATCH_H #define UI_PATCH_H -extern void cgit_print_patch(char *hex); +extern void cgit_print_patch(char *hex, const char *prefix); #endif /* UI_PATCH_H */ diff --git a/ui-shared.c b/ui-shared.c index 4fa506f..d5c4c10 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -383,19 +383,19 @@ void cgit_diff_link(const char *name, const char *title, const char *class, html("ss=1"); } html("'>"); html_txt(name); html("</a>"); } void cgit_patch_link(const char *name, const char *title, const char *class, - const char *head, const char *rev) + const char *head, const char *rev, const char *path) { - reporevlink("patch", name, title, class, head, rev, NULL); + reporevlink("patch", name, title, class, head, rev, path); } void cgit_stats_link(const char *name, const char *title, const char *class, const char *head, const char *path) { reporevlink("stats", name, title, class, head, NULL, path); } diff --git a/ui-shared.h b/ui-shared.h index 3df5464..c0e5c55 100644 --- a/ui-shared.h +++ b/ui-shared.h @@ -27,17 +27,17 @@ extern void cgit_log_link(const char *name, const char *title, const char *class, const char *head, const char *rev, const char *path, int ofs, const char *grep, const char *pattern, int showmsg); extern void cgit_commit_link(char *name, const char *title, const char *class, const char *head, const char *rev, int toggle_ssdiff); extern void cgit_patch_link(const char *name, const char *title, const char *class, const char *head, - const char *rev); + const char *rev, const char *path); extern void cgit_refs_link(const char *name, const char *title, const char *class, const char *head, const char *rev, const char *path); extern void cgit_snapshot_link(const char *name, const char *title, const char *class, const char *head, const char *rev, const char *archivename); extern void cgit_diff_link(const char *name, const char *title, const char *class, const char *head, |