]> gitweb.ps.run Git - ps-cgit/blobdiff - cgit.c
Add log filtering by path and link to it from tree view
[ps-cgit] / cgit.c
diff --git a/cgit.c b/cgit.c
index 2795ecce02b8b09dd05852d75fcc59f3bb85e634..9e63d185d5dde00a347f13ccf1fed7efc5dec6b2 100644 (file)
--- a/cgit.c
+++ b/cgit.c
@@ -79,29 +79,45 @@ static void cgit_print_repo_page(struct cacheitem *item)
        show_search = 0;
        setenv("GIT_DIR", cgit_repo->path, 1);
 
-       if (cgit_query_page && !strcmp(cgit_query_page, "snapshot")) {
+       if (cgit_query_page) {
+           if (cgit_repo->snapshots && !strcmp(cgit_query_page, "snapshot")) {
                cgit_print_snapshot(item, cgit_query_sha1, "zip", 
                                    cgit_repo->url, cgit_query_name);
                return;
+           }
+           if (!strcmp(cgit_query_page, "blob")) {
+                   cgit_print_blob(item, cgit_query_sha1, cgit_query_path);
+                   return;
+           }
        }
 
        if (cgit_query_page && !strcmp(cgit_query_page, "log"))
                show_search = 1;
+
        cgit_print_docstart(title, item);
-       cgit_print_pageheader(title, show_search);
+
+
        if (!cgit_query_page) {
+               cgit_print_pageheader("summary", show_search);
                cgit_print_summary();
-       } else if (!strcmp(cgit_query_page, "log")) {
-               cgit_print_log(cgit_query_head, cgit_query_ofs, 100, 
-                              cgit_query_search);
+               cgit_print_docend();
+               return;
+       }
+
+       cgit_print_pageheader(cgit_query_page, show_search);
+
+       if (!strcmp(cgit_query_page, "log")) {
+               cgit_print_log(cgit_query_head, cgit_query_ofs,
+                              cgit_max_commit_count, cgit_query_search,
+                              cgit_query_path);
        } else if (!strcmp(cgit_query_page, "tree")) {
-               cgit_print_tree(cgit_query_sha1, cgit_query_path);
+               cgit_print_tree(cgit_query_head, cgit_query_sha1, cgit_query_path);
        } else if (!strcmp(cgit_query_page, "commit")) {
                cgit_print_commit(cgit_query_sha1);
        } else if (!strcmp(cgit_query_page, "view")) {
-               cgit_print_view(cgit_query_sha1);
+               cgit_print_view(cgit_query_sha1, cgit_query_path);
        } else if (!strcmp(cgit_query_page, "diff")) {
-               cgit_print_diff(cgit_query_sha1, cgit_query_sha2);
+               cgit_print_diff(cgit_query_sha1, cgit_query_sha2, cgit_query_path);
        } else {
                cgit_print_error("Invalid request");
        }