summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--cmd.c2
-rw-r--r--ui-commit.c2
-rw-r--r--ui-patch.c6
-rw-r--r--ui-patch.h2
-rw-r--r--ui-shared.c4
-rw-r--r--ui-shared.h2
6 files changed, 10 insertions, 8 deletions
diff --git a/cmd.c b/cmd.c
index 893ae25..605876b 100644
--- a/cmd.c
+++ b/cmd.c
@@ -81,25 +81,25 @@ static void ls_cache_fn(struct cgit_context *ctx)
static void objects_fn(struct cgit_context *ctx)
{
cgit_clone_objects(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)
{
cgit_print_refs();
}
diff --git a/ui-commit.c b/ui-commit.c
index 2f4c6d4..b3a2063 100644
--- a/ui-commit.c
+++ b/ui-commit.c
@@ -51,25 +51,25 @@ void cgit_print_commit(char *hex, const char *prefix)
html_txt(info->committer);
if (!ctx.cfg.noplainemail) {
html(" ");
html_txt(info->committer_email);
}
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);
cgit_tree_link(sha1_to_hex(commit->tree->object.sha1), NULL, NULL,
ctx.qry.head, tmp, NULL);
html("</td></tr>\n");
for (p = commit->parents; p ; p = p->next) {
diff --git a/ui-patch.c b/ui-patch.c
index 2a8f7a5..25dc9fe 100644
--- a/ui-patch.c
+++ b/ui-patch.c
@@ -68,25 +68,25 @@ static void filepair_cb(struct diff_filepair *pair)
print_line(fmt("-Subproject %s", sha1_to_hex(pair->one->sha1)), 52);
if (S_ISGITLINK(pair->two->mode))
print_line(fmt("+Subproject %s", sha1_to_hex(pair->two->sha1)), 52);
return;
}
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;
if (get_sha1(hex, sha1)) {
cgit_print_error(fmt("Bad object id: %s", hex));
return;
@@ -113,17 +113,19 @@ void cgit_print_patch(char *hex)
htmlf(" %s", info->author_email);
}
html("\n");
html("Date: ");
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);
}
diff --git a/ui-patch.h b/ui-patch.h
index 9f68212..1641cea 100644
--- a/ui-patch.h
+++ b/ui-patch.h
@@ -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
@@ -379,27 +379,27 @@ void cgit_diff_link(const char *name, const char *title, const char *class,
delim = "&amp;";
}
if ((ctx.qry.ssdiff && !toggle_ssdiff) || (!ctx.qry.ssdiff && toggle_ssdiff)) {
html(delim);
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);
}
void cgit_self_link(char *name, const char *title, const char *class,
struct cgit_context *ctx)
{
if (!strcmp(ctx->qry.page, "repolist"))
diff --git a/ui-shared.h b/ui-shared.h
index 3df5464..c0e5c55 100644
--- a/ui-shared.h
+++ b/ui-shared.h
@@ -23,25 +23,25 @@ extern void cgit_tree_link(const char *name, const char *title,
extern void cgit_plain_link(const char *name, const char *title,
const char *class, const char *head,
const char *rev, const char *path);
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,
const char *new_rev, const char *old_rev,
const char *path, int toggle_ssdiff);
extern void cgit_stats_link(const char *name, const char *title,
const char *class, const char *head,