From ab42741c49d369e41c1e1915c6c024d79509f7d6 Mon Sep 17 00:00:00 2001 From: Johan Herland Date: Thu, 10 Jun 2010 01:09:32 +0200 Subject: ui-commit: Limit diff based on path limit in qry.path Signed-off-by: Johan Herland Signed-off-by: Lars Hjemli --- ui-commit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ui-commit.c') diff --git a/ui-commit.c b/ui-commit.c index b5e3c01..2f4c6d4 100644 --- a/ui-commit.c +++ b/ui-commit.c @@ -12,7 +12,7 @@ #include "ui-diff.h" #include "ui-log.h" -void cgit_print_commit(char *hex) +void cgit_print_commit(char *hex, const char *prefix) { struct commit *commit, *parent; struct commitinfo *info; @@ -117,7 +117,7 @@ void cgit_print_commit(char *hex) tmp = sha1_to_hex(commit->parents->item->object.sha1); else tmp = NULL; - cgit_print_diff(ctx.qry.sha1, tmp, NULL); + cgit_print_diff(ctx.qry.sha1, tmp, prefix); } cgit_free_commitinfo(info); } -- cgit v1.2.3-24-g4f1b From eac1b675414722ae90df75abc727b2795bc096f0 Mon Sep 17 00:00:00 2001 From: Johan Herland Date: Thu, 10 Jun 2010 01:09:33 +0200 Subject: ui-patch: Apply path limit to generated patch Also indicate in the comment section of the patch that a path limit was applied, too easily see when a generated patch is only partial. Signed-off-by: Johan Herland Signed-off-by: Lars Hjemli --- ui-commit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui-commit.c') diff --git a/ui-commit.c b/ui-commit.c index 2f4c6d4..b3a2063 100644 --- a/ui-commit.c +++ b/ui-commit.c @@ -60,7 +60,7 @@ void cgit_print_commit(char *hex, const char *prefix) 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); -- cgit v1.2.3-24-g4f1b From 34c2331d2c33ea28743a2ee3e62f7337ae9887f6 Mon Sep 17 00:00:00 2001 From: Johan Herland Date: Thu, 10 Jun 2010 01:09:34 +0200 Subject: ui-commit: Preserve path limit in links to tree and diff pages For tree links, the original link is unchanged, but in the case of a path limit, a subtree link is added to the right of the original tree link. Signed-off-by: Johan Herland Signed-off-by: Lars Hjemli --- ui-commit.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'ui-commit.c') diff --git a/ui-commit.c b/ui-commit.c index b3a2063..1793921 100644 --- a/ui-commit.c +++ b/ui-commit.c @@ -71,6 +71,10 @@ void cgit_print_commit(char *hex, const char *prefix) tmp = xstrdup(hex); cgit_tree_link(sha1_to_hex(commit->tree->object.sha1), NULL, NULL, ctx.qry.head, tmp, NULL); + if (prefix) { + html(" /"); + cgit_tree_link(prefix, NULL, NULL, ctx.qry.head, tmp, prefix); + } html("\n"); for (p = commit->parents; p ; p = p->next) { parent = lookup_commit_reference(p->item->object.sha1); @@ -86,7 +90,7 @@ void cgit_print_commit(char *hex, const char *prefix) ctx.qry.head, sha1_to_hex(p->item->object.sha1), 0); html(" ("); cgit_diff_link("diff", NULL, NULL, ctx.qry.head, hex, - sha1_to_hex(p->item->object.sha1), NULL, 0); + sha1_to_hex(p->item->object.sha1), prefix, 0); html(")"); parents++; } -- cgit v1.2.3-24-g4f1b From 685872b770be2af643d00365d5358e46687f7385 Mon Sep 17 00:00:00 2001 From: Johan Herland Date: Thu, 10 Jun 2010 01:09:35 +0200 Subject: 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 Signed-off-by: Lars Hjemli --- ui-commit.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'ui-commit.c') diff --git a/ui-commit.c b/ui-commit.c index 1793921..2d98ed9 100644 --- a/ui-commit.c +++ b/ui-commit.c @@ -58,14 +58,14 @@ void cgit_print_commit(char *hex, const char *prefix) html("\n"); html("commit"); tmp = sha1_to_hex(commit->object.sha1); - cgit_commit_link(tmp, NULL, NULL, ctx.qry.head, tmp, 0); + cgit_commit_link(tmp, NULL, NULL, ctx.qry.head, tmp, prefix, 0); html(" ("); 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); + cgit_commit_link("unidiff", NULL, NULL, ctx.qry.head, tmp, prefix, 1); else - cgit_commit_link("side-by-side diff", NULL, NULL, ctx.qry.head, tmp, 1); + cgit_commit_link("side-by-side diff", NULL, NULL, ctx.qry.head, tmp, prefix, 1); html(")\n"); html("tree"); tmp = xstrdup(hex); @@ -87,7 +87,8 @@ void cgit_print_commit(char *hex, const char *prefix) html("parent" ""); cgit_commit_link(sha1_to_hex(p->item->object.sha1), NULL, NULL, - ctx.qry.head, sha1_to_hex(p->item->object.sha1), 0); + ctx.qry.head, + sha1_to_hex(p->item->object.sha1), prefix, 0); html(" ("); cgit_diff_link("diff", NULL, NULL, ctx.qry.head, hex, sha1_to_hex(p->item->object.sha1), prefix, 0); -- cgit v1.2.3-24-g4f1b