about summary refs log tree commit diff
path: root/ui-shared.c
diff options
context:
space:
mode:
authorJohan Herland <johan@herland.net>2010-06-10 01:09:35 +0200
committerLars Hjemli <hjemli@gmail.com>2010-06-19 10:40:24 +0200
commit685872b770be2af643d00365d5358e46687f7385 (patch)
tree279a8399c3e9b189a7171df6ca009a58bf1bb8c7 /ui-shared.c
parentui-commit: Preserve path limit in links to tree and diff pages (diff)
downloadcgit-pink-685872b770be2af643d00365d5358e46687f7385.tar.gz
cgit-pink-685872b770be2af643d00365d5358e46687f7385.zip
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>
Diffstat (limited to 'ui-shared.c')
-rw-r--r--ui-shared.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/ui-shared.c b/ui-shared.c
index d5c4c10..372b9e7 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -319,7 +319,8 @@ void cgit_log_link(const char *name, const char *title, const char *class,
 }
 
 void cgit_commit_link(char *name, const char *title, const char *class,
-		      const char *head, const char *rev, int toggle_ssdiff)
+		      const char *head, const char *rev, const char *path,
+		      int toggle_ssdiff)
 {
 	if (strlen(name) > ctx.cfg.max_msg_len && ctx.cfg.max_msg_len >= 15) {
 		name[ctx.cfg.max_msg_len] = '\0';
@@ -330,7 +331,7 @@ void cgit_commit_link(char *name, const char *title, const char *class,
 
 	char *delim;
 
-	delim = repolink(title, class, "commit", head, NULL);
+	delim = repolink(title, class, "commit", head, path);
 	if (rev && strcmp(rev, ctx.qry.head)) {
 		html(delim);
 		html("id=");
@@ -466,7 +467,7 @@ void cgit_object_link(struct object *obj)
 	shortrev[10] = '\0';
 	if (obj->type == OBJ_COMMIT) {
                 cgit_commit_link(fmt("commit %s...", shortrev), NULL, NULL,
-				 ctx.qry.head, fullrev, 0);
+				 ctx.qry.head, fullrev, NULL, 0);
 		return;
 	} else if (obj->type == OBJ_TREE)
 		page = "tree";
@@ -793,7 +794,7 @@ void cgit_print_pageheader(struct cgit_context *ctx)
 		cgit_tree_link("tree", NULL, hc(ctx, "tree"), ctx->qry.head,
 			       ctx->qry.sha1, NULL);
 		cgit_commit_link("commit", NULL, hc(ctx, "commit"),
-				 ctx->qry.head, ctx->qry.sha1, 0);
+				 ctx->qry.head, ctx->qry.sha1, NULL, 0);
 		cgit_diff_link("diff", NULL, hc(ctx, "diff"), ctx->qry.head,
 			       ctx->qry.sha1, ctx->qry.sha2, NULL, 0);
 		if (ctx->repo->max_stats)