Add git_log_link() and fix bug in generic repolink function

The generic repolink function compared head with cgit_query_head, which
almost always would be the same pointer. The test now compares with
repo.defbranch, which is the wanted behavour.

Bug discovered while adding cgit_log_link(), so this commit also contain
that change.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
diff --git a/ui-summary.c b/ui-summary.c
index 4bda4c2..29b76e3 100644
--- a/ui-summary.c
+++ b/ui-summary.c
@@ -25,11 +25,7 @@
 	if (commit && !parse_commit(commit)){
 		info = cgit_parse_commit(commit);
 		html("<tr><td>");
-		url = cgit_pageurl(cgit_query_repo, "log",
-				   fmt("h=%s", refname));
-		html_link_open(url, NULL, NULL);
-		html_txt(buf);
-		html_link_close();
+		cgit_log_link(refname, NULL, NULL, refname, NULL, NULL);
 		html("</td><td>");
 		cgit_print_age(commit->date, -1, NULL);
 		html("</td><td>");