about summary refs log tree commit diff
path: root/ui-shared.c
diff options
context:
space:
mode:
Diffstat (limited to 'ui-shared.c')
-rw-r--r--ui-shared.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/ui-shared.c b/ui-shared.c
index 71c899a..15d8254 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -176,6 +176,28 @@ void cgit_commit_link(char *name, char *title, char *class, char *head,
 	reporevlink("commit", name, title, class, head, rev, NULL);
 }
 
+void cgit_diff_link(char *name, char *title, char *class, char *head,
+		    char *new_rev, char *old_rev, char *path)
+{
+	char *delim;
+
+	delim = repolink(title, class, "diff", head, path);
+	if (new_rev && strcmp(new_rev, cgit_query_head)) {
+		html(delim);
+		html("id=");
+		html_attr(new_rev);
+		delim = "&";
+	}
+	if (old_rev) {
+		html(delim);
+		html("id2=");
+		html_attr(old_rev);
+	}
+	html("'>");
+	html_txt(name);
+	html("</a>");
+}
+
 void cgit_print_date(time_t secs, char *format)
 {
 	char buf[64];