author | Johan Herland <johan@herland.net> | 2010-06-09 23:09:35 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2010-06-19 08:40:24 (UTC) |
commit | 685872b770be2af643d00365d5358e46687f7385 (patch) (unidiff) | |
tree | 279a8399c3e9b189a7171df6ca009a58bf1bb8c7 | |
parent | 34c2331d2c33ea28743a2ee3e62f7337ae9887f6 (diff) | |
download | cgit-685872b770be2af643d00365d5358e46687f7385.zip cgit-685872b770be2af643d00365d5358e46687f7385.tar.gz cgit-685872b770be2af643d00365d5358e46687f7385.tar.bz2 |
ui-commit: Preserve path limit in links to commit page
This includes adding a path argument to cgit_commit_link() and updating all
its callers. The callers from within the commit page (i.e. the "commit",
"unidiff"/"side-by-side diff" and "parent" links) all preserve the path
limit of the current commit page. All other callers pass NULL (i.e. no path
limit).
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | ui-commit.c | 9 | ||||
-rw-r--r-- | ui-log.c | 4 | ||||
-rw-r--r-- | ui-refs.c | 2 | ||||
-rw-r--r-- | ui-shared.c | 9 | ||||
-rw-r--r-- | ui-shared.h | 3 |
5 files changed, 15 insertions, 12 deletions
diff --git a/ui-commit.c b/ui-commit.c index 1793921..2d98ed9 100644 --- a/ui-commit.c +++ b/ui-commit.c | |||
@@ -60,3 +60,3 @@ void cgit_print_commit(char *hex, const char *prefix) | |||
60 | tmp = sha1_to_hex(commit->object.sha1); | 60 | tmp = sha1_to_hex(commit->object.sha1); |
61 | cgit_commit_link(tmp, NULL, NULL, ctx.qry.head, tmp, 0); | 61 | cgit_commit_link(tmp, NULL, NULL, ctx.qry.head, tmp, prefix, 0); |
62 | html(" ("); | 62 | html(" ("); |
@@ -65,5 +65,5 @@ void cgit_print_commit(char *hex, const char *prefix) | |||
65 | if ((ctx.qry.ssdiff && !ctx.cfg.ssdiff) || (!ctx.qry.ssdiff && ctx.cfg.ssdiff)) | 65 | if ((ctx.qry.ssdiff && !ctx.cfg.ssdiff) || (!ctx.qry.ssdiff && ctx.cfg.ssdiff)) |
66 | cgit_commit_link("unidiff", NULL, NULL, ctx.qry.head, tmp, 1); | 66 | cgit_commit_link("unidiff", NULL, NULL, ctx.qry.head, tmp, prefix, 1); |
67 | else | 67 | else |
68 | cgit_commit_link("side-by-side diff", NULL, NULL, ctx.qry.head, tmp, 1); | 68 | cgit_commit_link("side-by-side diff", NULL, NULL, ctx.qry.head, tmp, prefix, 1); |
69 | html(")</td></tr>\n"); | 69 | html(")</td></tr>\n"); |
@@ -89,3 +89,4 @@ void cgit_print_commit(char *hex, const char *prefix) | |||
89 | cgit_commit_link(sha1_to_hex(p->item->object.sha1), NULL, NULL, | 89 | cgit_commit_link(sha1_to_hex(p->item->object.sha1), NULL, NULL, |
90 | ctx.qry.head, sha1_to_hex(p->item->object.sha1), 0); | 90 | ctx.qry.head, |
91 | sha1_to_hex(p->item->object.sha1), prefix, 0); | ||
91 | html(" ("); | 92 | html(" ("); |
@@ -68,3 +68,3 @@ void show_commit_decorations(struct commit *commit) | |||
68 | cgit_commit_link(buf, NULL, "deco", ctx.qry.head, | 68 | cgit_commit_link(buf, NULL, "deco", ctx.qry.head, |
69 | sha1_to_hex(commit->object.sha1), 0); | 69 | sha1_to_hex(commit->object.sha1), NULL, 0); |
70 | } | 70 | } |
@@ -91,3 +91,3 @@ void print_commit(struct commit *commit) | |||
91 | cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head, | 91 | cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head, |
92 | sha1_to_hex(commit->object.sha1), 0); | 92 | sha1_to_hex(commit->object.sha1), NULL, 0); |
93 | show_commit_decorations(commit); | 93 | show_commit_decorations(commit); |
@@ -76,3 +76,3 @@ static int print_branch(struct refinfo *ref) | |||
76 | if (ref->object->type == OBJ_COMMIT) { | 76 | if (ref->object->type == OBJ_COMMIT) { |
77 | cgit_commit_link(info->subject, NULL, NULL, name, NULL, 0); | 77 | cgit_commit_link(info->subject, NULL, NULL, name, NULL, NULL, 0); |
78 | html("</td><td>"); | 78 | html("</td><td>"); |
diff --git a/ui-shared.c b/ui-shared.c index d5c4c10..372b9e7 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -321,3 +321,4 @@ void cgit_log_link(const char *name, const char *title, const char *class, | |||
321 | void cgit_commit_link(char *name, const char *title, const char *class, | 321 | void cgit_commit_link(char *name, const char *title, const char *class, |
322 | const char *head, const char *rev, int toggle_ssdiff) | 322 | const char *head, const char *rev, const char *path, |
323 | int toggle_ssdiff) | ||
323 | { | 324 | { |
@@ -332,3 +333,3 @@ void cgit_commit_link(char *name, const char *title, const char *class, | |||
332 | 333 | ||
333 | delim = repolink(title, class, "commit", head, NULL); | 334 | delim = repolink(title, class, "commit", head, path); |
334 | if (rev && strcmp(rev, ctx.qry.head)) { | 335 | if (rev && strcmp(rev, ctx.qry.head)) { |
@@ -468,3 +469,3 @@ void cgit_object_link(struct object *obj) | |||
468 | cgit_commit_link(fmt("commit %s...", shortrev), NULL, NULL, | 469 | cgit_commit_link(fmt("commit %s...", shortrev), NULL, NULL, |
469 | ctx.qry.head, fullrev, 0); | 470 | ctx.qry.head, fullrev, NULL, 0); |
470 | return; | 471 | return; |
@@ -795,3 +796,3 @@ void cgit_print_pageheader(struct cgit_context *ctx) | |||
795 | cgit_commit_link("commit", NULL, hc(ctx, "commit"), | 796 | cgit_commit_link("commit", NULL, hc(ctx, "commit"), |
796 | ctx->qry.head, ctx->qry.sha1, 0); | 797 | ctx->qry.head, ctx->qry.sha1, NULL, 0); |
797 | cgit_diff_link("diff", NULL, hc(ctx, "diff"), ctx->qry.head, | 798 | cgit_diff_link("diff", NULL, hc(ctx, "diff"), ctx->qry.head, |
diff --git a/ui-shared.h b/ui-shared.h index c0e5c55..3cc1258 100644 --- a/ui-shared.h +++ b/ui-shared.h | |||
@@ -31,3 +31,4 @@ extern void cgit_commit_link(char *name, const char *title, | |||
31 | const char *class, const char *head, | 31 | const char *class, const char *head, |
32 | const char *rev, int toggle_ssdiff); | 32 | const char *rev, const char *path, |
33 | int toggle_ssdiff); | ||
33 | extern void cgit_patch_link(const char *name, const char *title, | 34 | extern void cgit_patch_link(const char *name, const char *title, |