cgit

commit 51140311bb3b0d4d0e859d5045ffe4c74478f5fe

Author: Lars Hjemli <hjemli@gmail.com>

Add search parameters to cgit_log_link

This makes the [prev] and [next] links work correctly on search results.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>

 cgit.h | 3 ++-
 ui-log.c | 6 ++++--
 ui-repolist.c | 3 ++-
 ui-shared.c | 13 +++++++++++--
 ui-summary.c | 2 +-
 ui-tree.c | 2 +-


diff --git a/cgit.h b/cgit.h
index 42036c30f1ddea942063695c33c53e59c0f28ec3..163f355a022dab2dbbdb6f61b6040bacf3730c68 100644
--- a/cgit.h
+++ b/cgit.h
@@ -238,7 +238,8 @@
 extern void cgit_tree_link(char *name, char *title, char *class, char *head,
 			   char *rev, char *path);
 extern void cgit_log_link(char *name, char *title, char *class, char *head,
-			  char *rev, char *path, int ofs);
+			  char *rev, char *path, int ofs, char *grep,
+			  char *pattern);
 extern void cgit_commit_link(char *name, char *title, char *class, char *head,
 			     char *rev);
 extern void cgit_refs_link(char *name, char *title, char *class, char *head,




diff --git a/ui-log.c b/ui-log.c
index e7f7d6f43daf86212951455f307a0d0ddfa89533..9f5fdf6dbbaf43bca750a4040302cea5169f39da 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -118,13 +118,15 @@ 		html("
"); if (ofs > 0) { cgit_log_link("[prev]", NULL, NULL, cgit_query_head, cgit_query_sha1, cgit_query_path, - ofs - cnt); + ofs - cnt, cgit_query_grep, + cgit_query_search); html("&nbsp;"); } if ((commit = get_revision(&rev)) != NULL) { cgit_log_link("[next]", NULL, NULL, cgit_query_head, cgit_query_sha1, cgit_query_path, - ofs + cnt); + ofs + cnt, cgit_query_grep, + cgit_query_search); } html("</div>"); } diff --git a/ui-repolist.c b/ui-repolist.c index 4c86543673855e40adf43a33d32bfcf1297f899e..9aa5c1ede644b5ed4755ab3a79bea101ef0ae3f8 100644 --- a/ui-repolist.c +++ b/ui-repolist.c @@ -98,7 +98,8 @@ html(""); html_link_open(cgit_repourl(cgit_repo->url), NULL, "button"); html("summary</a>"); - cgit_log_link("log", NULL, "button", NULL, NULL, NULL, 0); + cgit_log_link("log", NULL, "button", NULL, NULL, NULL, + 0, NULL, NULL); cgit_tree_link("tree", NULL, "button", NULL, NULL, NULL); html("</td>"); } diff --git a/ui-shared.c b/ui-shared.c index 1d6694041baac51f214477a803a8c9360fe31347..a03661ac987d72d799e8e5cdfb94a19ac8864f8b 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -194,7 +194,7 @@ reporevlink("tree", name, title, class, head, rev, path); } void cgit_log_link(char *name, char *title, char *class, char *head, - char *rev, char *path, int ofs) + char *rev, char *path, int ofs, char *grep, char *pattern) { char *delim; @@ -204,6 +204,15 @@ html(delim); html("id="); html_attr(rev); delim = "&"; + } + if (grep && pattern) { + html(delim); + html("qt="); + html_attr(grep); + delim = "&"; + html(delim); + html("q="); + html_attr(pattern); } if (ofs > 0) { html(delim); @@ -461,7 +470,7 @@ html("

\n

navigate

\n"); reporevlink(NULL, "summary", NULL, "menu", cgit_query_head, NULL, NULL); cgit_log_link("log", NULL, "menu", cgit_query_head, - cgit_query_sha1, cgit_query_path, 0); + cgit_query_sha1, cgit_query_path, 0, NULL, NULL); cgit_tree_link("tree", NULL, "menu", cgit_query_head, cgit_query_sha1, NULL); cgit_commit_link("commit", NULL, "menu", cgit_query_head, diff --git a/ui-summary.c b/ui-summary.c index 39fe33078b737b8c4d7f58e6344677149e0a4604..c856793b978da4e05b7eb81de236d3fc3df8875b 100644 --- a/ui-summary.c +++ b/ui-summary.c @@ -56,7 +56,7 @@ if (!info) return 1; html("<tr><td>"); - cgit_log_link(name, NULL, NULL, name, NULL, NULL, 0); + cgit_log_link(name, NULL, NULL, name, NULL, NULL, 0, NULL, NULL); html("</td><td>"); if (ref->object->type == OBJ_COMMIT) { diff --git a/ui-tree.c b/ui-tree.c index d6bcec3cfefd21e16e7d4e37737c13ec0949915f..c22e30b82ef08f0901fe32d8ebe72afdc7b6e919 100644 --- a/ui-tree.c +++ b/ui-tree.c @@ -100,7 +100,7 @@ htmlf("%li", size); html("<td>"); cgit_log_link("log", NULL, "button", cgit_query_head, curr_rev, - fullpath, 0); + fullpath, 0, NULL, NULL); html("</td></tr>\n"); free(name); return 0;